Jump to content

cceloo

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • First Name
    Lukas
  • Last Name
    Celovsky

Recent Profile Visitors

98 profile views

cceloo's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi Madman! Maybe a bit late, but I've figured out the solution. One problem is, that both id_carrier and $delivery_option[$cart->id_address_delivery] are not integers, but strings! Also, the "$delivery_option[$cart->id_address_delivery]" string has a comma after it. You have to also update the total price before you call the validateOrder function. This code should work on PS 1.6.1.5: (if you plan to add a product to the cart, recalculate the $total variable after you change the cart content) $cart->id_carrier = "8"; $delivery_option = $cart->getDeliveryOption(); $delivery_option[$cart->id_address_delivery] = "8,"; $cart->setDeliveryOption($delivery_option); $cart->update(); $total = $this->context->cart->getOrderTotal(true, Cart::BOTH); $this->module->validateOrder((int)$this->context->cart->id, Configuration::get('PS_OS_PREPARATION'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key); I hope this will help somebody else.
  2. Hi dorje! Try to replace these lines: {if $product->active != 1} {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat name=cats} {if $smarty.foreach.cats.last} {assign var="cat_url" value="{$link->getCategoryLink({$cat.id_category})}"} {/if} {/foreach} {php} header("HTTP/1.1 301 Moved Permanently"); header("Location: {$cat_url}"); {/php} {/if} with something like this: {if $product->active != 1} {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat name=cats} {assign var="cat_url" value="{$link->getCategoryLink({$cat.id_category})}"} <meta name="cat_id" content="{$cat.id_category}" /> {/foreach} {/if} Then, there should be no redirect, but in the <head></head> section of your page, you should see meta tags with category ids. The last meta tag with cat_id would contain the id of category, to which the page would be redirected. I hope this will help you debug the problem yourself.
  3. I'm sorry for resurrecting an old thread, but I have a solution to the mentioned problem, which may save some time for somebody else. It's tested on Prestashop 1.6.1.5, but I think it will be compatible at least with the rest of 1.6 versions. Inside the header.tpl file, add the following code - it will redirect all disabled products to the product's category page. {if $page_name == 'product'} {if $product->active != 1} {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat name=cats} {if $smarty.foreach.cats.last} {assign var="cat_url" value="{$link->getCategoryLink({$cat.id_category})}"} {/if} {/foreach} {php} header("HTTP/1.1 301 Moved Permanently"); header("Location: {$cat_url}"); {/php} {/if} {/if} Note: You also have to enable the {php}{/php} tag support, which has been disabled in some prestashop versions: File config/smarty.config.inc.php Change the following: define('_PS_SMARTY_DIR_', _PS_TOOL_DIR_.'smarty/'); require_once(_PS_SMARTY_DIR_.'Smarty.class.php'); global $smarty; $smarty = new SmartyCustom(); $smarty->setCompileDir(_PS_CACHE_DIR_.'smarty/compile'); to define('_PS_SMARTY_DIR_', _PS_TOOL_DIR_.'smarty/'); require_once(_PS_SMARTY_DIR_.'SmartyBC.class.php'); global $smarty; $smarty = new SmartyBC(); $smarty->setCompileDir(_PS_CACHE_DIR_.'smarty/compile'); I hope this will help.
×
×
  • Create New...