prak Posted February 18, 2017 Share Posted February 18, 2017 Hello, I have a product with an attribute called "Cloth" with two values. I am trying to create a module named "customizeproducts" for the product page which would allow the user to choose the value and add the product to cart. ( I know that prestashop allows it by default but I want to accomplish it with my module ) I have added a button to add the product to cart using cart->updateQty(). However, I am getting this error "Product not found product no longer available" on clicking the button. Refreshing the page after sometime shows that the cart is not empty. Here is my code: customizeproducts.php public function hookDisplayFooterProduct() { $product_id = $_GET['id_product']; $product = new Product($product_id); $int_product_id = (int)$product_id; $currency = "rupees "; $newcart = new Cart($this->context->cookie->id_cart); $product_price = ($currency).$product -> price; $product_name = $product -> name[1]; $attrs=$product->getAttributesGroups($this->context->language->id); $quantity = 1; $id_customization = (int)Tools::getValue('id_customization'); $operator = Tools::getValue('op','up'); $id_address_delivery = (int)Tools::getValue('id_address_delivery'); $this->context->smarty->assign( array( 'customize_products_name' => Configuration::get('CUSTOMIZEPRODUCTS_NAME'), 'customize_products_link' => $this->context->link->getModuleLink('customizeproducts', 'display'), 'name' => $product_name, 'id' => $int_product_id, 'price' => $product_price, 'attrs' => $attrs, 'cart' => $newcart, 'quantity' => $quantity, 'id_customization' =>$id_customization, 'operator' => $operator, 'iad' => $id_address_delivery ) ); return $this->display(__FILE__, 'customizeproducts.tpl'); } customizeproducts.tpl {foreach from=$attrs key=id_attribute_group item=group} <a class="exclusive button ajax_add_to_cart_button" href="{$cart->updateQty($quantity,$id,$group.id_attribute,$id_customization,$operator,$iad)}"> <span>{$group.attribute_name}</span> </a> {/foreach} How can I solve this issue? 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