Jump to content

Order tunnel breaks on customer address


polaije

Recommended Posts

Hi,

I just upgrade to 1.7.4.2 and I have detected during the order process that with certain countries after the creation of addres  the process return to the address page with message "one new address created" and I have to call the cart again to continue the order but without succeeding to arrive to the carriers step because no carriers are displayed and this without any message.

This is not the same behavior with the country Belgium (site country), the carriers are directly shown after the creation of address.

My questions are :

 Where do I have to search in the core files to isolate the issue ?
Can the carrier module (bpost) be responsible of this behavior ?

Please can you help me to search where this happened.

Jean-Marie 

Link to comment
Share on other sites

All the zones are created in countries. Only a difference with the name Belgium and Belgique.

I manage to get it working with reinitializing the default settings for address but order tunnel exit to address page after creation of first address. I have to call the cart and strangly the address comes with the message the billing address is different. In this case I can see the carriers. If the billing and destination address are the same on the page, the continue button does not have any effect.

The initial problem was not only with Netherland but also other countries except Belgium.

You are in Netherland, can you make a test for me at Pharmanovea.com.

Thanks, 

Jean-Marie

 

Link to comment
Share on other sites

The version is the one after upgrade from 1.7.4.0 to 1.7.4.2.

I have to say that I have an override to stop orders for specific products in countries outside Belgium.

The problem is the order tunnel exit after creating an address with not Belgium countries. We can recall the cart to continue but this is not good.

 

Link to comment
Share on other sites

I am the author of this override. I am not an expert in PHP, it prevents clients from countries outside Belgium to buy a specific category.

Here is the code :

application/x-httpd-phpOrderController.php ( C++ source, ASCII text )

<?php
/**
 * @author PresTeamShop.com
 * @copyright PresTeamShop.com - 2013
 */
class OrderController extends OrderControllerCore
{
    /*
	* module: restrictedproduct
	* date: 2015-07-19 15:34:42
	* version: 1.0.6
	*/
	public function initContent()
	{
         require_once (_PS_MODULE_DIR_ . 'RestrictedProductMedipim/RestrictedProductMedipim.php');
        
        if (Configuration::isCatalogMode()) {
            Tools::redirect('index.php');
        }

        $this->restorePersistedData($this->checkoutProcess);
        $this->checkoutProcess->handleRequest(
            Tools::getAllValues()
        );

        $presentedCart = $this->cart_presenter->present($this->context->cart);

        if (count($presentedCart['products']) <= 0 || $presentedCart['minimalPurchaseRequired']) {
            // if there is no product in current cart, redirect to cart page
            $cartLink = $this->context->link->getPageLink('cart');
            Tools::redirect($cartLink);
        }

        $product = $this->context->cart->checkQuantities(true);
        if (is_array($product)) {
            // if there is an issue with product quantities, redirect to cart page
            $cartLink = $this->context->link->getPageLink('cart', null, null, array('action' => 'show'));
            Tools::redirect($cartLink);
        }
        
       $msg="";
        
        if (count($presentedCart['products']) > 0 ) {
            if(!empty($this->context->cart->id)){                
                $id_address_delivery = (int)$this->context->cart->id_address_delivery;
                $address = new Address($id_address_delivery);
                $id_country_address = $address->id_country;
				if($id_country_address != null) {
				if($id_country_address != 3){
    					$products = $this->context->cart->getProducts(); 
                                    
    
                        
                        $msg_restricted_products = 'One or more products can not be sold in the country listed in your address delivery' . ': ';
                        
                        foreach ($products as $product) {
                            $id_product = (int)$product['id_product'];
                            
                            if(RestrictedProductMedipim::checkProduct($id_product)!= ""){
                                $msg_restricted_products = $msg_restricted_products . $product['name'] . ', ' ;
                                $msg="error";
                            }
                        }
                        
                        if ($msg !="") {
                            $this->errors[] = $this->trans($msg_restricted_products, array(), 'Shop.Notifications.Error');
                            echo '<script type="text/javascript">document.getElementById("checkout-payment-step").style.visibility="hidden";);</script>';
                            
                        }                
                        
    				}
				}
            }
          
        }

        

        $this->checkoutProcess
            ->setNextStepReachable()
            ->markCurrentStep()
            ->invalidateAllStepsAfterCurrent();

        $this->saveDataToPersist($this->checkoutProcess);

        if (!$this->checkoutProcess->hasErrors() && $msg=="") {
            if ($_SERVER['REQUEST_METHOD'] !== 'GET' && !$this->ajax) {
                return $this->redirectWithNotifications(
                    $this->checkoutProcess->getCheckoutSession()->getCheckoutURL()
                );
            }
		}
	    else {
	        $cartLink = $this->context->link->getPageLink('cart', null, null, array('action' => 'show'));
            
	        $this->redirectWithNotifications($cartLink);
	        
	        //$cartLink = $this->context->link->getPageLink('cart', null, null, array('action' => 'show'));
            //Tools::redirect($cartLink);
	    }
	
       
        parent::initContent();
	}
	

}

	

The RestrictedProductMedipim is a function in a module that I also wrote.

Do you see Something wrong in my code ?

Link to comment
Share on other sites

I tested this issue with a site clone without cache and I found the error in …./themes/core.js:1544, see the img

You can have it with presta17.pharmanovea.com

Dont take the jpg error into account, the img are not at correct location.

JsError2.thumb.jpg.af87eb43961564a976ab83768ba0c649.jpg

 

JsError.jpg

Link to comment
Share on other sites

The presta17.... site is out, I had a problem with the cloner.

I just remove the cache from javascript to be able to track the error on pharmanovea.com.

Remember, my problem is just that for non Belgium countries the order exit and shows the address page (new address added) and we have to call the cart again to continue.

Link to comment
Share on other sites

One up on this issue...

I finally understand why the problem of exiting the order occurs with Belgium, this is because it is designed as default country.

On the order page, when we change the country in the address step, the button change from Continue to Save and the address confirmation page is loaded interrupting the order process. As Belgium is the default we dont have to change it.

Is this the normal behavior ?

If it is we have a problem having a small country as default.

Concerning the xmlhttprequest error it occurs in themes/node.js at line 1544 and I Don't know if it has an effect on the normal order procedure.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...