RamsesLeroi Posted April 9, 2014 Share Posted April 9, 2014 Hi, i have a webshop with only 1 carrier. When i try to order something it shows 2 carrieres even is there is only 1 carrier in the backoffice. The second carrier has free shipping so this is a problem. We already got orders we made a loss on because of the free shipping. When i click on the first carrier (the only one that's supposed to be showing) and click next, and then back again, the second carrier is gone. Also sometimes when I disable the cache it 'fixes' the problem temporally (but only on this computer). Hope someone can help me? Link to comment Share on other sites More sharing options...
PascalVG Posted April 12, 2014 Share Posted April 12, 2014 Ramses, try this: go to your host and start your database manager (cPanel->phpMyAdmin or so) go to your database and - select table ps_carrier_lang - check the name of the carrier you DON'T want anymore. - Check which id_carrier belongs to that one - Then select ps_carrier table - check which row has the id_carrier that belongs to the carrier you DON'T want - of that row, click in the "active" field and change the 1 to 0 (zero) see if the problem is solved in the front office. Hope this helps, pascal Link to comment Share on other sites More sharing options...
De Angel Net Posted April 13, 2014 Share Posted April 13, 2014 I had this problem when using prestashop 1.5.1. Try to remove all carrier module and install it again. Link to comment Share on other sites More sharing options...
RamsesLeroi Posted May 13, 2014 Author Share Posted May 13, 2014 I tried both you solutions, but none worked. I deleted all the active carriers in the database, readded them in the backoffice but the free carrier is still there. The weird thing is that it's a multishop and the problem is only in one of the 2 shops. I tried copying the order-carrier.tpl so it's exact the same file. nothing worked. Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted May 13, 2014 Share Posted May 13, 2014 What is your Prestashop version ? it look like prestashop cache issue. Disable chache, and then do clear chache. Check via FTP to make sure all cache files has been deleted from your Prestashop /cache/ directory or /smarty/compile/ directory If you are use cloud service like cloudflare, make sure to clear cache on your cloud service provider side too. Link to comment Share on other sites More sharing options...
RamsesLeroi Posted May 13, 2014 Author Share Posted May 13, 2014 (edited) What is your Prestashop version ? it look like prestashop cache issue. Disable chache, and then do clear chache. Check via FTP to make sure all cache files has been deleted from your Prestashop /cache/ directory or /smarty/compile/ directory If you are use cloud service like cloudflare, make sure to clear cache on your cloud service provider side too. Tried that already. disabled the cache completely in BO and also tried deleting it in FTP but that takes the whole day. it takes so long that it just stops deleting after a while without everything being deleted. i can try deleting it trough ssh, maybe it will be faster then. Our version is PrestaShop™ 1.5.4.1 but whe can't update beceause then we probably need to change our import scripts. When i looked in the database in the orders table i saw that the carrier ID was 0 when someone used the carrier we don't want. Edited May 13, 2014 by RamsesLeroi (see edit history) Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted May 13, 2014 Share Posted May 13, 2014 After disabled cache and clear cache, don't forget to activate force smarty compile option to make sure the theme file is recompiled. In this case, i think you don't have to delete all cache files or all smarty compiled files But you have to make sure order-carrier.tpl compiled file was deleted With FTP, browse to directory /cache/smarty/compile/ and then with FTP "Search" feature, you can search for a file with keyword "file.order-carrier.tpl.php" (without Quotes) If you've found such files, you should delete it. Reload front office page Order-Carrier to make sure theme file order-carrier.tpl was recompiled and the unwanted carrier was not there anymore Link to comment Share on other sites More sharing options...
RamsesLeroi Posted May 14, 2014 Author Share Posted May 14, 2014 After disabled cache and clear cache, don't forget to activate force smarty compile option to make sure the theme file is recompiled. In this case, i think you don't have to delete all cache files or all smarty compiled files But you have to make sure order-carrier.tpl compiled file was deleted With FTP, browse to directory /cache/smarty/compile/ and then with FTP "Search" feature, you can search for a file with keyword "file.order-carrier.tpl.php" (without Quotes) If you've found such files, you should delete it. Reload front office page Order-Carrier to make sure theme file order-carrier.tpl was recompiled and the unwanted carrier was not there anymore Well, i tried disabling the cache and recompiling it in the backoffice (since manuallly deleting didn't work) but nothing. Also ik changed things in the order-carrier.tpl file and it was updated immediately, so i don't think it will work if i delete the cache. What's strange is that 'The best price and speed' shows twice, once with the correct carrier and once with the carrier we don't want. How could they both be the cheapest if one is free and one is €7,95 Link to comment Share on other sites More sharing options...
PascalVG Posted May 15, 2014 Share Posted May 15, 2014 Ramses, Does the carrier that shows up wrongly, have an ID of value = 0 in the database as well? If you want, I can have a quick look in your tables to see if I see anything wrong. If you want this, please add a temporary employee (Admin->Employee), with admin rights to both your shops, and PM (Don't post here, Private Message!) the login info: login name, password, URLs to shop admin pages. Suggested employee login name: [email protected] ) pascal. Link to comment Share on other sites More sharing options...
RamsesLeroi Posted May 16, 2014 Author Share Posted May 16, 2014 Im familiar with phpmyadmin and i know for sure that there is no carrier with ID 0. I actually deleted all carriers in the database and readded them manually. Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted May 17, 2014 Share Posted May 17, 2014 a little bit complicated to predicting what is going wrong here, since we can't see or check directly on your prestashop.If you are sure this is not a cache issue, then maybe this is a database issue.Because you are familiar with phpmyadmin, then you should check following database table :MandatoryPREFIX_carrierPREFIX_carrier_langPREFIX_carrier_zonePREFIX_carrier_groupPREFIX_carrier_shopOptional but affectingPREFIX_cart_rule_carrierPREFIX_product_carrierPREFIX_warehouse_carrierWon't affecting to this issue, but have a relations with your carriersPREFIX_range_pricePREFIX_range_weightPREFIX_deliveryPREFIX_ordersPREFIX_order_carrierPREFIX_carrier_tax_rules_group_shop --------------------------------------------------------------- Note : Default Prestashop database PREFIX is ps_ Link to comment Share on other sites More sharing options...
RamsesLeroi Posted May 20, 2014 Author Share Posted May 20, 2014 well i do think its a cache issue beceause it is affecting it. Sometimes the problem's gone after deleting the cache. or on someone else's computer its gone. I already tried deleting local cache. Link to comment Share on other sites More sharing options...
gonebdg - webindoshop.com Posted May 20, 2014 Share Posted May 20, 2014 I hope you're understand about cache and how to handle cache issue, not only prestashop cache and smarty compiled files, but includes browser cache and internet connection cache.And i hope you're also understand about the Prestashop carriers database table in relation to this issue.First, please make sure this isn't cache issue. Link to comment Share on other sites More sharing options...
iGiorgis Posted May 31, 2014 Share Posted May 31, 2014 i have the same problem without something from me suddenly i have a second carrier (My Carrier) but its not mine. and second problem, admin dont receive a notification (inside BO) for new order Link to comment Share on other sites More sharing options...
RamsesLeroi Posted June 3, 2014 Author Share Posted June 3, 2014 i don't have that second problem you have, maybe you should make your own topic? I have hidden the extra carrier with css so it's still possible to order without shipping cost but it's a lot harder now. it's just a temporary solution. if you want, iGiorgis, i can hide your second carrier with css for you. Link to comment Share on other sites More sharing options...
iGiorgis Posted June 3, 2014 Share Posted June 3, 2014 i don't have that second problem you have, maybe you should make your own topic? I have hidden the extra carrier with css so it's still possible to order without shipping cost but it's a lot harder now. it's just a temporary solution. if you want, iGiorgis, i can hide your second carrier with css for you. thx Ramses, but i delete some old carriers from mySQL and now seems ok. My eshop is not ready for public and with that solution seems to work ok now. the only "problem" is i still dont receive the order notification at the top of admin's BO but the email notification is ok Link to comment Share on other sites More sharing options...
Yankee_PL Posted August 27, 2014 Share Posted August 27, 2014 Hi Ramses Leroi. Have you found the solution for you problem? I have the same issu here. Link to comment Share on other sites More sharing options...
RamsesLeroi Posted September 1, 2014 Author Share Posted September 1, 2014 Sorry Yankee_PL. Still nothing, only the temporary hiding solution with CSS. Maybe one day we will upgrade to 1.6 and it will be good. Link to comment Share on other sites More sharing options...
Yankee_PL Posted September 1, 2014 Share Posted September 1, 2014 Sorry Yankee_PL. Still nothing, only the temporary hiding solution with CSS. Maybe one day we will upgrade to 1.6 and it will be good. Hmm Im on presta 1.6 so the problem still remains. I did hide with css also but it is only tempoorary as you said. Im still searching so I'l let you know when I find a solution. Best Tegards. 1 Link to comment Share on other sites More sharing options...
irrelevant Posted September 21, 2014 Share Posted September 21, 2014 I had the same issue... even in 1.6.0.9... There is something in the carrier calculation logic that is creating it, but I simply cannot find it. It is definitely being generated server-side because a print_r of the return from getDeliveryOptionList() near the start of Cart::simulateCarriersOutput() has this on the end: [0,] => Array ( [carrier_list] => Array ( [0] => Array ( [price_with_tax] => [price_without_tax] => 0 [package_list] => Array ( [0] => 0 ) [product_list] => Array ( ) [instance] => Carrier Object ( [id_reference] => [name] => ..etc.... all zero, empty or default values, including a carrier id of 0. I couldn't find where it was being created - there's a lot of complicated logic 'upstream' so I ended up adding to the end of that function: $c = array(); foreach ($carriers as &$carrier) if (!empty($carrier['name'])) $c[] = $carrier; return $c; //was $carriers; - this sorted out the carriercompare module, but not the main shopping cart. So I pretty much gave up at that point, and just modified order-carrier.tpl to not display if there was no carrier name - here's a diff diff order-carrier.tpl order-carrier.tpl.bak 70a71,76 > {assign var="blankc" value="0"} > {foreach from=$option.carrier_list key=mykey item=value name=clist} > {if $smarty.foreach.clist.first}{if !$value.instance->name} > {assign var="blankc" value="1"}{/if}{/if} > {/foreach} > {if !$blankc} 259a266 > {/if}HTH. Link to comment Share on other sites More sharing options...
Yankee_PL Posted April 13, 2015 Share Posted April 13, 2015 Hi, After long searching i have found the solution that works in my case. The problem is in classes/cart.php. And actualy fresh version fixes it corectly but If you can't upgrade your version here is what I've copied from new version of cart.php. It starts around 1881 line: /** * Get all deliveries options available for the current cart * @param Country $default_country * @param boolean $flush Force flushing cache * * @return array array( * 0 => array( // First address * '12,' => array( // First delivery option available for this address * carrier_list => array( * 12 => array( // First carrier for this option * 'instance' => Carrier Object, * 'logo' => <url to the carriers logo>, * 'price_with_tax' => 12.4, * 'price_without_tax' => 12.4, * 'package_list' => array( * 1, * 3, * ), * ), * ), * is_best_grade => true, // Does this option have the biggest grade (quick shipping) for this shipping address * is_best_price => true, // Does this option have the lower price for this shipping address * unique_carrier => true, // Does this option use a unique carrier * total_price_with_tax => 12.5, * total_price_without_tax => 12.5, * position => 5, // Average of the carrier position * ), * ), * ); * If there are no carriers available for an address, return an empty array */ public function getDeliveryOptionList(Country $default_country = null, $flush = false) { static $cache = array(); if (isset($cache[$this->id]) && !$flush) return $cache[$this->id]; $delivery_option_list = array(); $carriers_price = array(); $carrier_collection = array(); $package_list = $this->getPackageList(); // Foreach addresses foreach ($package_list as $id_address => $packages) { // Initialize vars $delivery_option_list[$id_address] = array(); $carriers_price[$id_address] = array(); $common_carriers = null; $best_price_carriers = array(); $best_grade_carriers = array(); $carriers_instance = array(); // Get country if ($id_address) { $address = new Address($id_address); $country = new Country($address->id_country); } else $country = $default_country; // Foreach packages, get the carriers with best price, best position and best grade foreach ($packages as $id_package => $package) { // No carriers available if (count($packages) == 1 && count($package['carrier_list']) == 1 && current($package['carrier_list']) == 0) { $cache[$this->id] = array(); return $cache[$this->id]; } $carriers_price[$id_address][$id_package] = array(); // Get all common carriers for each packages to the same address if (is_null($common_carriers)) $common_carriers = $package['carrier_list']; else $common_carriers = array_intersect($common_carriers, $package['carrier_list']); $best_price = null; $best_price_carrier = null; $best_grade = null; $best_grade_carrier = null; // Foreach carriers of the package, calculate his price, check if it the best price, position and grade foreach ($package['carrier_list'] as $id_carrier) { if (!isset($carriers_instance[$id_carrier])) $carriers_instance[$id_carrier] = new Carrier($id_carrier); $price_with_tax = $this->getPackageShippingCost($id_carrier, true, $country, $package['product_list']); $price_without_tax = $this->getPackageShippingCost($id_carrier, false, $country, $package['product_list']); if (is_null($best_price) || $price_with_tax < $best_price) { $best_price = $price_with_tax; $best_price_carrier = $id_carrier; } $carriers_price[$id_address][$id_package][$id_carrier] = array( 'without_tax' => $price_without_tax, 'with_tax' => $price_with_tax); $grade = $carriers_instance[$id_carrier]->grade; if (is_null($best_grade) || $grade > $best_grade) { $best_grade = $grade; $best_grade_carrier = $id_carrier; } } $best_price_carriers[$id_package] = $best_price_carrier; $best_grade_carriers[$id_package] = $best_grade_carrier; } // Reset $best_price_carrier, it's now an array $best_price_carrier = array(); $key = ''; // Get the delivery option with the lower price foreach ($best_price_carriers as $id_package => $id_carrier) { $key .= $id_carrier.','; if (!isset($best_price_carrier[$id_carrier])) $best_price_carrier[$id_carrier] = array( 'price_with_tax' => 0, 'price_without_tax' => 0, 'package_list' => array(), 'product_list' => array(), ); $best_price_carrier[$id_carrier]['price_with_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $best_price_carrier[$id_carrier]['price_without_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; $best_price_carrier[$id_carrier]['package_list'][] = $id_package; $best_price_carrier[$id_carrier]['product_list'] = array_merge($best_price_carrier[$id_carrier]['product_list'], $packages[$id_package]['product_list']); $best_price_carrier[$id_carrier]['instance'] = $carriers_instance[$id_carrier]; $real_best_price = !isset($real_best_price) || $real_best_price > $carriers_price[$id_address][$id_package][$id_carrier]['with_tax'] ? $carriers_price[$id_address][$id_package][$id_carrier]['with_tax'] : $real_best_price; $real_best_price_wt = !isset($real_best_price_wt) || $real_best_price_wt > $carriers_price[$id_address][$id_package][$id_carrier]['without_tax'] ? $carriers_price[$id_address][$id_package][$id_carrier]['without_tax'] : $real_best_price_wt; } // Add the delivery option with best price as best price $delivery_option_list[$id_address][$key] = array( 'carrier_list' => $best_price_carrier, 'is_best_price' => true, 'is_best_grade' => false, 'unique_carrier' => (count($best_price_carrier) <= 1) ); // Reset $best_grade_carrier, it's now an array $best_grade_carrier = array(); $key = ''; // Get the delivery option with the best grade foreach ($best_grade_carriers as $id_package => $id_carrier) { $key .= $id_carrier.','; if (!isset($best_grade_carrier[$id_carrier])) $best_grade_carrier[$id_carrier] = array( 'price_with_tax' => 0, 'price_without_tax' => 0, 'package_list' => array(), 'product_list' => array(), ); $best_grade_carrier[$id_carrier]['price_with_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $best_grade_carrier[$id_carrier]['price_without_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; $best_grade_carrier[$id_carrier]['package_list'][] = $id_package; $best_grade_carrier[$id_carrier]['product_list'] = array_merge($best_grade_carrier[$id_carrier]['product_list'], $packages[$id_package]['product_list']); $best_grade_carrier[$id_carrier]['instance'] = $carriers_instance[$id_carrier]; } // Add the delivery option with best grade as best grade if (!isset($delivery_option_list[$id_address][$key])) $delivery_option_list[$id_address][$key] = array( 'carrier_list' => $best_grade_carrier, 'is_best_price' => false, 'unique_carrier' => (count($best_grade_carrier) <= 1) ); $delivery_option_list[$id_address][$key]['is_best_grade'] = true; // Get all delivery options with a unique carrier foreach ($common_carriers as $id_carrier) { $key = ''; $package_list = array(); $product_list = array(); $price_with_tax = 0; $price_without_tax = 0; foreach ($packages as $id_package => $package) { $key .= $id_carrier.','; $price_with_tax += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $price_without_tax += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; $package_list[] = $id_package; $product_list = array_merge($product_list, $package['product_list']); } if (!isset($delivery_option_list[$id_address][$key])) $delivery_option_list[$id_address][$key] = array( 'is_best_price' => false, 'is_best_grade' => false, 'unique_carrier' => true, 'carrier_list' => array( $id_carrier => array( 'price_with_tax' => $price_with_tax, 'price_without_tax' => $price_without_tax, 'instance' => $carriers_instance[$id_carrier], 'package_list' => $package_list, 'product_list' => $product_list, ) ) ); else $delivery_option_list[$id_address][$key]['unique_carrier'] = (count($delivery_option_list[$id_address][$key]['carrier_list']) <= 1); } } $cart_rules = CartRule::getCustomerCartRules(Context::getContext()->cookie->id_lang, Context::getContext()->cookie->id_customer, true, true, false, $this); $result = Db::getInstance('SELECT * FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart='.$this->id); $cart_rules_in_cart = array(); if (is_array($result) && count($result)) foreach ($result as $row) $cart_rules_in_cart[] = $row['id_cart_rule']; $total_products_wt = $this->getOrderTotal(true, Cart::ONLY_PRODUCTS); $total_products = $this->getOrderTotal(false, Cart::ONLY_PRODUCTS); $free_carriers_rules = array(); foreach ($cart_rules as $cart_rule) { $total_price = $cart_rule['minimum_amount_tax'] ? $total_products_wt : $total_products; $total_price += $cart_rule['minimum_amount_tax'] && $cart_rule['minimum_amount_shipping'] ? $real_best_price : 0; $total_price += !$cart_rule['minimum_amount_tax'] && $cart_rule['minimum_amount_shipping'] ? $real_best_price_wt : 0; if ($cart_rule['free_shipping'] && $cart_rule['carrier_restriction'] && $cart_rule['minimum_amount'] <= $total_price) { $cr = new CartRule((int)$cart_rule['id_cart_rule']); if (Validate::isLoadedObject($cr) && $cr->checkValidity(Context::getContext(), in_array((int)$cart_rule['id_cart_rule'], $cart_rules_in_cart), false, false)) { $carriers = $cr->getAssociatedRestrictions('carrier', true, false); if (is_array($carriers) && count($carriers) && isset($carriers['selected'])) foreach ($carriers['selected'] as $carrier) if (isset($carrier['id_carrier']) && $carrier['id_carrier']) $free_carriers_rules[] = (int)$carrier['id_carrier']; } } } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now