Search the Community
Showing results for tags 'Product Controller'.
-
Hello guys , In Prestashop 1.7 I want allow users to visit inactive products I mean i want them to be visited from URL only , I know that i must override the ProductController function init() but i don't know witch part to change (override), to make this possible on the shop. any Help ?. Thank you, Have a good day.
- 2 replies
-
- inactive
- prestashop 1.7x
-
(and 2 more)
Tagged with:
-
Hi, I got one issue which is need to ask who were expert person to help me solve this problem. I got this error issue during using the Product Combination Generator which is I have a lot of item on Product Attributes need to insert to a product. During process (a long time pending proses / buffer / hang / stuck around more than 3-5 minutes), the error come out after sometimes. And after enable the server log error, I found the error stated:- <<< Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /home/photolen/public_html/shop/controllers/front/ProductController.php on line 545 >>> I've spend a lot of time made some research to find the solution but the result very disappointed. Could someone please show me how I can solve this issue. Hope you can understand my explanation better. **please refer to the attachment given if you need some more view Thank a lot!
- 1 reply
-
- fatal error
- 500 server error
- (and 6 more)
-
Hi! I´m trying to override AdminProductController.php and this is working fine, with almost all my overrided functions, but I ´m trying to import another distinct prices.js located in my module folder (original is located in /rootfolder/js/ folder). The strange thing here is that js is not set in setMedia function but in postProcess (look at adminProductController of ps 1.5.6) and changing _PS_JS_DIR_.'price.js', to _PS_MODULE_DIR_.'pricerules/js/price.js', is not working If I look with the chrome inspector, I see the imported file is the original one and not my module js. Any ideas about what I´m doing wrong ?
- 2 replies
-
- override
- product controller
-
(and 1 more)
Tagged with:
-
PS version 1.4.9.0 Hi For a product with combimations, when all the combinations are out of stock I get the following Warning: Warning: Invalid argument supplied for foreach() in /home/my domain/public_html/controllers/ProductController.php on line 324 This is the code at line 324: foreach ($combinations as $id_product_attribute => $comb) { $attributeList = ''; foreach ($comb['attributes'] as $id_attribute) $attributeList .= '\''.(int)$id_attribute.'\','; $attributeList = rtrim($attributeList, ','); $combinations[$id_product_attribute]['list'] = $attributeList; } self::$smarty->assign(array( 'groups' => $groups, 'combinaisons' => $combinations, /* Kept for compatibility purpose only */ 'combinations' => $combinations, 'colors' => (count($colors) && $this->product->id_color_default) ? $colors : false, 'combinationImages' => $combinationImages)); When all combinations for the product are out of stock $combinations is Null, hence the warning. A solution might be to wrap the code above in an: ' if ($combinations) ' statement. Th only thing is that non of the code above would be executed. When $combination is Null the data is set as: groups = array(0) {} combinations = NULL colors = array(0) {} So should I just apply the ' if ($combinations) ' statement to the 'foreach block' or both the 'foreach block' and the $smarty->assign block ? Thanks Chris G
-
In the product page of prestashop 1.5.0.17, the thumbnails are not showing because the image width and the image height are showing up blank after the page is rendered. However, when I go to the productcontroller page, it is showing that there are definitions for them. I don't want to manually adjust the size of the thumbnails. It should be dynamic based on the mediumSize. Can someone please let me know if they encounter this problem before and how they manage to fix it? product.tpl <li id="thumbnail_{$image.id_image}"> <a href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox')}" rel="other-views" class="thickbox {if $smarty.foreach.thumbnails.first}shown{/if}" title="{$image.legend|htmlspecialchars}"> <img id="thumb_{$image.id_image}" src="{$link->getImageLink($product->link_rewrite, $imageIds, 'medium')}" alt="{$image.legend|htmlspecialchars}" height="{$mediumSize.height}" width="{$mediumSize.width}" /> </a> </li> ProductController.php public function initContent() { parent::initContent(); // Assign template vars related to the images $this->assignImages(); } protected function assignImages() { $images = $this->product->getImages((int)$this->context->cookie->id_lang); $product_images = array(); foreach ($images as $k => $image) { if ($image['cover']) { $this->context->smarty->assign('mainImage', $images[0]); $cover = $image; $cover['id_image'] = (Configuration::get('PS_LEGACY_IMAGES') ? ($this->product->id.'-'.$image['id_image']) : $image['id_image']); $cover['id_image_only'] = (int)$image['id_image']; } $product_images[(int)$image['id_image']] = $image; } if (!isset($cover)) $cover = array('id_image' => $this->context->language->iso_code.'-default', 'legend' => 'No picture', 'title' => 'No picture'); $size = Image::getSize('large'); $this->context->smarty->assign(array( 'have_image' => Product::getCover((int)Tools::getValue('id_product')), 'cover' => $cover, 'imgWidth' => (int)$size['width'], 'mediumSize' => Image::getSize('medium'), 'largeSize' => Image::getSize('large'), 'homeSize' => Image::getSize('home'), 'col_img_dir' => _PS_COL_IMG_DIR_)); if (count($product_images)) $this->context->smarty->assign('images', $product_images); }