tasfe / silverstripe-ecommerce

Automatically exported from code.google.com/p/silverstripe-ecommerce
0 stars 0 forks source link

Cannot checkout when not logged into CMS #104

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make sure you are logged out of CMS
2. Add a product to cart
3. Choose "Go To Checkout"

What is the expected output?
We see the checkout page with registration form

What do you see instead?
Error message: 
[Notice] Undefined variable: array

Line 125 in 
/Users/dlowndes/Sites/ecommerce_site.local/webroot/ecommerce/code/control/Shoppi
ngCart.php
Source

116                     //5. check GEOIP information
117                     if(!$countryCode) {
118                         $countryCode = Geoip::visitor_country();
119                         //6. check default country....
120                         if(!$countryCode) {
121                             $countryCode = Geoip::$default_country_code;
122                             //7. check default countries from ecommerce...
123                             if(!$countryCode) {
124                                 $a = EcommerceRole::get_allowed_country_codes();
125                                 if(is_array($a) && count($array)) {
126                                     $countryCode = array_shift($a);
127                                 }
128                             }
129                         }
130                     }
131                 }

Trace

    * ShoppingCart::get_country()
      Line 293 of EcommerceRole.php
    * EcommerceRole->getEcommerceFields()
    * call_user_func_array(Array,Array)
      Line 693 of Object.php
    * Object->__call(getEcommerceFields,Array)
      Line 23 of OrderForm.php
    * Member->getEcommerceFields()
      Line 23 of OrderForm.php
    * OrderForm->__construct(CheckoutPage_Controller,OrderForm)
      Line 251 of CheckoutPage.php
    * CheckoutPage_Controller->OrderForm()
      Line 369 of ViewableData.php
    * ViewableData->obj(OrderForm,,,1)
      Line 446 of ViewableData.php
    * ViewableData->XML_val(OrderForm,,1)
      Line 448 of .cache.ecommerce.templates.Layout.CheckoutPage.ss
    * include(/private/var/tmp/silverstripe-cache-Users-dlowndes-Sites-ecommerce_site.local-webroot/.cache.ecommerce.templates.Layout.CheckoutPage.ss)
      Line 420 of SSViewer.php
    * SSViewer->process(CheckoutPage_Controller,Zend_Cache_Frontend_Output)
      Line 411 of SSViewer.php
    * SSViewer->process(CheckoutPage_Controller)
      Line 202 of Controller.php
    * Controller->handleAction(SS_HTTPRequest)
      Line 143 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
      Line 147 of Controller.php
    * Controller->handleRequest(SS_HTTPRequest)
      Line 199 of ContentController.php
    * ContentController->handleRequest(SS_HTTPRequest)
      Line 67 of ModelAsController.php
    * ModelAsController->handleRequest(SS_HTTPRequest)
      Line 282 of Director.php
    * Director::handleRequest(SS_HTTPRequest,Session)
      Line 125 of Director.php
    * Director::direct(/checkout/)
      Line 127 of main.php

Please use labels and text to provide additional information.

Original issue reported on code.google.com by dtlown...@gmail.com on 17 Feb 2011 at 10:38

GoogleCodeExporter commented 9 years ago
Fix is to change

125 if(is_array($a) && count($array)) {
to
125 if(is_array($a) && count($a)) {

Original comment by dtlown...@gmail.com on 17 Feb 2011 at 11:12

GoogleCodeExporter commented 9 years ago
fixed!

Original comment by nfranc...@gmail.com on 18 Feb 2011 at 2:19

GoogleCodeExporter commented 9 years ago

Original comment by nfranc...@gmail.com on 18 Feb 2011 at 2:19