SilverCart Forum

We moderate this Forum and we're here to help. Have you already run a forum search to check if your problem has already been solved?

You can help us helping you by providing detailed error messages, screenshots and logfile entries.

SebastianRamon

Page: 1 , 2
Topic Undefined index: en_US 14015 Views

Undefined index: en_US

9 November 2012 at 4:31pm

Hi all,
I'm still here...

while I'm going to do a /dev/build on my development site, the manifest-builder send back to me a strange "notice" as below:


[Notice] Undefined index: en_US
GET /magicfitness3.it/index.php/dev/build

Line 1036 in /opt/lampp/htdocs/magicfitness3.it/silvercart/code/base/SilvercartPaymentMethod.php

Source

1027 $languages = array('de_DE', 'en_US', 'en_GB');
1028 $fallbackLocale = false;
1029
1030 if (!in_array(Translatable::get_current_locale(), $languages)) {
1031 $languages[] = Translatable::get_current_locale();
1032 $fallbackLocale = Translatable::get_current_locale();
1033 }
1034
1035 if ($fallbackLocale !== false) {
1036 $languages[$fallbackLocale] = $languages['en_US'];
1037 }
1038 $languageClassName = $this->ClassName . 'Language';
1039 foreach ($languages as $language) {
1040 $relationField = $this->ClassName . 'ID';
1041 $filter = sprintf("`Locale` = '%s' AND `%s` = '%s'", $language, $relationField, $paymentMethod->ID);
1042 $langObj = DataObject::get_one($languageClassName, $filter);

I have tried to look at the code in the specified file but I don't understand which index is not found!

Can you tell me more about it?

Thanks

Bye

Max

Re: Undefined index: en_US

10 November 2012 at 10:31am Last edited: 10 November 2012 10:31am

Hi Max,

can you add a

var_dump($languages);

before line 1036 or add a breakpoint in your debugger to check the value of the variable $languages?

Seems a bit odd, maybe something with your current_locale is not right.

We can look into this issue in more depth on monday.

Have a nice weekend.

Ciao
Ramon

Re: Undefined index: en_US

12 November 2012 at 9:37am

Hi Ramon,

the result of var_dump($languages) is

array(4) { [0]=> string(5) "de_DE" [1]=> string(5) "en_US" [2]=> string(5) "en_GB" [3]=> string(5) "it_IT" }

Pls. reply asap... I don't understand why

Thx,

bye.

Max

Re: Undefined index: en_US

12 November 2012 at 4:32pm

Hi Max,

this is a bug, we're on it.

Cheers
Ramon

Re: Undefined index: en_US

12 November 2012 at 5:18pm

Hi Max,

fixed this thing.

You can download the fixed version on bitbucket (use the tip).

If it is urgent, you can remove line 1035 - 1037 out of the SilvercartPaymentMethod.php inside your installation, but I do not recommend that!

1035 if ($fallbackLocale !== false) {
1036 $languages[$fallbackLocale] = $languages['en_US'];
1037 }

Regards,
Sebastian

Re: Undefined index: en_US

12 November 2012 at 6:57pm Last edited: 12 November 2012 6:57pm

Hi all,

I have downloaded the new file SilvercartPaymentMethod from BitBucket, and I have overwrite the old file, but after the /dev/build I have an error like this:


[User Error] Uncaught Exception: Object->__call(): the method 'createrequiredorderstatus' does not exist on 'SilvercartPaymentIPayment'

GET /magicfitness7.it/index.php/dev/build/?flush=all

Line 724 in /opt/lampp/htdocs/magicfitness7.it/sapphire/core/Object.php

Source

715             
716             default :
717                throw new Exception (
718                   "Object->__call(): extra method $method is invalid on $this->class:" . var_export($config, true)
719                );
720          }
721       } else {
722          // Please do not change the exception code number below.
723          
724          throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'", 2175);
725       }
726    }
727    
728    // -----------------------------------------------------------------------------------------------------------------
729    
730    /**

Thanks in advance.

Bye

Max

Re: Undefined index: en_US

12 November 2012 at 9:20pm

Hi Max,

if you update just the single file, all the other changes we made since you last downloaded SilverCart are missing. To have a consistent repository, you should update the whole SilverCart project and checkout the complete tip.

The "quick and dirty"-way would be just to remove the code Sebastian mentioned and skip all the other changes we made.

As you can see in the commit logs, we are updating the tip almost on a daily basis, this is why updating the whole project is the better way.

To get an idea how much has changed since you downloaded SilverCart, just check https://bitbucket.org/silvercart/silvercart/changesets ;-)

Cheers
Ramon

Re: Undefined index: en_US

13 November 2012 at 12:21pm

ok, ok Ramon I have make a stupid error...

Now, with /dev/build I haven't got any error!

Thanks.

Bye.

Max