Search the Community
Showing results for tags 'product.php'.
-
Hi everyone! Unless I have missed it, I don't think that my problem has been raised in previous post, so I hope someone will be able to help me or direct me to the right place. 😊 I am currently setting up a shop with Prestashop version 8 where I want to show in the Special block and Prices Drop page only products with the 'on_sale' flag. To do so, I've been following this topic that is quite simple: create an override of Product.php and in the functions getRandomSpecial() and getPricesDrop() add to SQL WHERE conditions 'p.`on_sale`= 1 AND '. I tried to put this at the beginning of the WHERE condition, with and without brackets surrounding the rest of the condition, I tried to put it at the end of the condition and I also did so directly in the main Product.php disabling the override one. Before every attempt I cleared the cache through the BO or by erasing directories in /var/cache/. Whichever way I tried, the Prices Drop page still has every products with a specific price, even those that are not labeled as 'on_sale'... It is as if other getRandomSpecial() and getPricesDrop() functions exist somewhere else and has the priority over my modified queries... Can someone help me understand what is happening? NB: In the case of Prices Drop page, I went down the rabbit hole of looking into controllers/front/listing/PricesDropController.php then Adapter\PricesDrop\PricesDropProductSearchProvider.php to see where getPricesDrop() is called and it is definitely called through Product class.
- 2 replies
-
- special prices
- getrandomspecial
- (and 5 more)
-
Hi, I need to get a list of all the products in Product.php in order to pass it to product.tpl. That way I will be able to access some kind of $products variable from product.tpl, just like it can be done in products.tpl with the $listing.products variable. My problem is that I don't really know PHP and I have no idea on how to implement it inside Product.php. My guess is that it should be a relatively easy thing to do, so I would appreciate if someone could give me an answer (taking into account my little knowledge of PHP).
-
- product
- product page
-
(and 4 more)
Tagged with:
-
Hi, My problem is to add a message on product page for product referenced in a new table restrictedproduct. In this table only id_product is present. To do the trick I have adapt (with override) the product class (product.php) like this : added : public $restricted; added in $definition : 'restricted' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isString'), adapt the sql : public static function getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category = false, $only_active = false, Context $context = null) { $sql = 'SELECT p.*, product_shop.*, pl.* , m.`name` AS manufacturer_name, s.`name` AS supplier_name, re.id_product As restricted FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').') LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) LEFT JOIN `'._DB_PREFIX_.'supplier` s ON (s.`id_supplier` = p.`id_supplier`)'. ($id_category ? 'LEFT JOIN `'._DB_PREFIX_.'category_product` c ON (c.`id_product` = p.`id_product`)' : ''). 'LEFT JOIN `'._DB_PREFIX_.'restrictedproduct` re ON (p.`id_product` = re.`id_product`)'. 'WHERE pl.`id_lang` = '.(int)$id_lang. ($id_category ? ' AND c.`id_category` = '.(int)$id_category : ''). ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : ''). ($only_active ? ' AND product_shop.`active` = 1' : '').' ORDER BY '.(isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way). ($limit > 0 ? ' LIMIT '.(int)$start.','.(int)$limit : ''); } And in Template product-addtional-info.tpl : <div class="product-additional-info"> {hook h='displayProductAdditionalInfo' product=$product} <p>iciiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii {$product.restricted} </div> I succed to have no error in compilation but Nothing is shown for the id_product that I select in my sql. I think that the selection is for products and not product but I cannot find the function in the class that get an individual product. Can you help me to solve this problem ? Thanks, Jean-Marie
- 4 replies
-
- product
- custom field
-
(and 1 more)
Tagged with:
-
Hello everyone, My store uses two variables to determine pricing for thousands of products, so I am trying to base my pricing in a way that i can upload two different prices from a csv import. I have been trying to do this by adding specific price to wholesale price but i am a coding newb and haven't been able to get it quite right. For this example, my specific price is $5.38 and my wholesale price is 1.50. I want the price to output $6.88. In prestashop 1.4.9.0 I made a change in /admin/tabs/Product.php lines 1831-1835 from: if (!$specific_price || $specific_price['price'] == 0) $price = (float)$result['price']; else $price = (float)$specific_price['price']; to: if (!$specific_price || $specific_price['price'] == 0) $price = (float)$result['price'] + 1.50 ; else $price = (float)$specific_price['price'] + 1.50 ; This change added $1.50 to all of my products on the product pages but each product has a unique wholesale price. I know i'm on the right track but I dont know how to insert the variable for wholesale price. I've substituted the "1.50" with things like "$id_wholesale_price", "wholesale_price", "$wholesale_price", etc to no success. I also probably have to make changes in /themes/product.js but i am not sure. I've been tinkering with this for a few days now, can someone please help? Thank you in advance.
- 4 replies
-
- wholesale price
- specific price
-
(and 1 more)
Tagged with:
-
Hello, Can you explain me how this code works in product.tpl ? I know php, JavaScript so i understand that there is a foreach loop that fill a JavaScript array. But i can’t find where the php array is from. It should be in Product.php Class but i don’t find it. I ask because i try to understand how to get combination product images. Thanks the code : // Images var img_prod_dir = '{$img_prod_dir}'; var combinationImages = new Array(); {if isset($combinationImages)} {foreach from=$combinationImages item='combination' key='combinationId' name='f_combinationImages'} combinationImages[{$combinationId}] = new Array(); {foreach from=$combination item='image' name='f_combinationImage'} combinationImages[{$combinationId}][{$smarty.foreach.f_combinationImage.index}] = {$image.id_image|intval}; {/foreach} {/foreach} {/if} combinationImages[0] = new Array(); {if isset($images)} {foreach from=$images item='image' name='f_defaultImages'} combinationImages[0][{$smarty.foreach.f_defaultImages.index}] = {$image.id_image}; {/foreach} {/if}
- 8 replies
-
- combination
- $combinationImages
-
(and 3 more)
Tagged with:
-
Hi, I try to add two new fields to my Prestashop 1.6.0.14 http://www.thecartridgecompany.eu to use for product import. The fields that I added are printer_type cartridge_nummer When I fill those fields manually I get Unknown column 'printer_type' in 'field list' see attachment new added fields What did do wrong? 1) I added the fields in my database, see attachment (added fields to Database) 2) in the informations.tpl i add this lines {* start added by WBF *} <div class="form-group"> <label class="control-label col-lg-3" for="printer_type"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='printer_type'} {l s='Allowed special characters:'} .-_#\"> {$bullet_common_field} {l s='printer_type'} </span> </label> <div class="col-lg-5"> <input type="text" id="printer_type" name="printer_type" value="{$product->printer_type|htmlentitiesUTF8}" /> </div> </div> <div class="form-group"> <label class="control-label col-lg-3" for="cartridge_nummer"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='cartridge_nummer'} {l s='Allowed special characters:'} .-_#\"> {$bullet_common_field} {l s='cartridge_nummer'} </span> </label> <div class="col-lg-5"> <input type="text" id="cartridge_nummer" name="cartridge_nummer" value="{$product->cartridge_nummer|htmlentitiesUTF8}" /> </div> </div> {* end added by WBF *} 3) In my product.php I added /** @var string printer type */ public $printer_type; /** @var string cartridge nummer */ public $cartridge_nummer; and /* fields added by WBF */ /* 'printer_type' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),*/ /* 'cartridge_nummer' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),*/ 'printer_type' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'), 'cartridge_nummer' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'), Now I can see the added fields I my B.O but cannot use because i'm missing something.. What do I do wrong?
-
- new fields
- import
- (and 6 more)
-
Hello everyone :-) A-Z order is supposedly the default order for combination names. However, I am running PS 1.5.6.1 and thay are currently ordered by ID instead of name, which is a mess for me. I know I can use "position" field to force a specific combination order, but it's not possible for me to use that feature because of other technical reasons. I just need to alter the SQL query in classes/product.php for attribute combinations to be sorted alphabetically. Could anyone give a hand, please? ;-) I have tried thing like this with no luck, at line 1869 inside public function "getAttributeCombinations", and line 1913 inside public function "getAttributeCombinationsById": From this: ORDER BY pa.`id_product_attribute`'; To this: ORDER BY agl.`public_name`, agl.`name`, al.`name`'; There's no change at all (not even an error, hehehe). Attribute combinations keep on being sorted by ID. Am I looking at the wrong function? Thank youuuuu!! :-))
-
Bonjour, Je souhaiterai afficher dans la page product_list le résultat de fonctions que j'ai créé dans la class PHP Product. Comment puis-je faire appel à ces fonctions dans product_list.tpl ? J'utilise prestashop 1.5.6.
- 2 replies
-
- product_list.tpl
- class PHP
-
(and 1 more)
Tagged with:
-
Bonjour à tous, Je possède un site tournant avec Prestashop. Actuellement, lorsqu'on consulte les pages de produits, ces derniers sont classés par défaut du plus récent au plus ancien avec 3 produits par ligne. Maintenant, mon site fonctionne bien et j'aimerais mettre en place une règle permettant de mieux cibler les produits. Plutôt que de trier les produits par date, on aurait: - Sur chaque ligne (3 produits): 1 best sellers, 1 nouveautés et 1 produit au hasard. Je ne vois pas du tout comment mettre cela en place à cause de la pagination de Prestashop puisqu'à chaque changement de page, on a une nouvelle requête (s'il n'y avait qu'une seule requête, j'aurais pu faire les traitements nécessaires sur mon tableau final). Je ne sais pas si je suis clair, c'est assez compliqué d'expliquer le problème. Merci à tous
-
- tri
- prestashop
-
(and 1 more)
Tagged with:
-
Hi guys I woke up this morning to find my site had been shut down by my provider. They have finally come back to me and say: On closer inspection of server logs there was a problem occurring in regards to the "product.php" script. I see that the script was identified by the server at 14:30 (GMT) on the 21st May for running for a very long time and causing server problems. The file in question is -> ./public_html/shop/product.php Anyone have any thoughts on this? Im guessing I just remove it and reinstall but still waiting to hear back from them. Thanks As I cant log in I cant see what version Im on but its 1.4 something, the latest version doesn't work with some of my modules.
-
Je tente de faire un override de Product.php avec la version 1.5.3.1 mais il n'est jamais appelé. (j'en avais fait un qui fonctionnait avec la 1.4.8) Je travaille avec une version 1.5.3.1 installée à partir de zéro. J'ai modifié /classes/stock/StockAvailable.php pour y intégrer le patch de Rémi Gaillard du 16 janvier : http://scm.prestashop.com/changelog/PrestaShop_v.1.5?cs=d0074ed72491292b2ec4b8fe8ceb87f7585c2e72 portant sur : Hook actionUpdateQuantity was not called for product without attributes which depends on the physical stock Il n'y a normalement rien d'autre à faire que surcharger override/classes/Product.php puisque dans la 1.5 sa coquille existe. C'est bien ça. Qu'aurais-je oublié ? Merci par avance des regards éclairants sur mon problème. <?php class Product extends ProductCore { public static function actionUpdateQuantity($product, $id_order = NULL) { parent::actionUpdateQuantity($product, $id_order); mon code... } } ?>
- 1 reply
-
- override
- prestashop 1.5
-
(and 2 more)
Tagged with:
-
After upgrading (oneclickupgrade) from 1.4.8.3 to 1.4.9.0 my product pages does not show! They are only blank (white)! My categories is showing fine, but when i click on a product in a category (and prestashop calls f.ex product.php?id_product=17) i only get a blank page. This goes for any prodcut in my store!! Help!! I get no errors when debugging and i really dont know what to do! And yes the setting "Use Smarty 2 instead of 3" is set on no! The strange thing is i have not seen anybody else having this problem??
- 8 replies
-
- blank page
- white page
-
(and 1 more)
Tagged with:
-
Hola que tal, quisiera me pudieran ayudar, orientar, o regañar, todo es bien recibido, tengo una tienda de un cliente la cual desde hace poco tiempo a presentado ya muchos problemas con el consumo de recursos del servidor donde esta hospedada la tienda, los módulos o archivos que siempre están con un consumo de más eran index.php así como category.php y product.php, todo empezó con la versión prestashop 1.3.2.3 tomando en cuenta que es una versión un poco vieja, pase a actualizar a la versión prestashop 1.3.7.0 donde ahora después de 2 días de actualizar me presenta errores en category.php product.php y sendtoafriend-form.php es ultimo al no ser muy usado la verdad es que se desactivo, pongo ejemplos que el sistema de soporte de mi hospedaje me muestra. %CPU 124 - /usr/bin/php /home/xxxxx/public_html/product.php %CPU 82.0 - /usr/bin/php /home/xxxxx/public_html/product.php %CPU 80.0 - /usr/bin/php /home/xxxxx/public_html/category.php %CPU 127 - <defunct>%CPU 98.0 - /usr/bin/php /home/xxxxx/public_html/modules/sendtoafriend/sendtoafriend-form.php %CPU 92.0 - /usr/bin/php /home/xxxxx/public_html/product.php Así como estos ejemplo puedo poner los de una semana entera o más de dos, ya no se por donde ver, cambios aquí ver y leer de ciertos errores por aquí, a la tienda se le a invertido mucho, incluso cuenta con una ip fija, y un SSL para poder trabajar, la página para más datos se encuentra hospedada en un servidor compartido, antes con más visitas pues se lleva registro en analytics, no se tenían estos problemas, y ahora con un 20% a 30% menos de visitas, da estos problemas, el trafico no es tanto, el uso tampoco, pero me tiene vuelvo loco, el que mi servicio de hospedaje me tenga que estar cancelando ó bloqueando el acceso publico a la página. Si me pueden ayudar, informando sobre como mejorar el manejo de recursos, datos, etc se los agradeceré, de mi parte eh optimizado las imágenes a tener menos contenido en todos los modulos que muestran algo, en fin, espero que lo que he hecho ayude, pero seguro llegara un punto donde me de lata, y no se que hacer. ¡Help! ¡Ayuda! ¡Por favor! me voy a volver loco.
- 1 reply
-
- Server
- product.php
-
(and 3 more)
Tagged with:
-
Bonjour, J'ai essayé d'installer, réinstaller blockcategories mais rien y fait, il ne veux pas s'afficher correctement dans ma page product.php, dans category.php, ou d'autres pages, pas de problème, jsute product.php dans index.php, je ne l'affiche pas mais si j'essaye de le réafficher, cela ne change rien. En fait, le block est en place, le titre apparait mais sur le premier <ul>, au lieu de <ul class="tree dynamized" style="display: block;"> J'ai <ul class="tree dhtml" style="display: none;"> et je n'arrive pas à voir où se génère le dhtml" style="display: none;" je vois bien dans blockcategories.tpl <ul class="tree {if $isDhtml}dhtml{/if}"> et dans blockcategories.php $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); Mais je ne sais pas quoi en faire pour résoudre le problème, merci de votre aide, site naishprocenterleucate.com/test/
- 1 reply
-
- affichage
- product.php
-
(and 1 more)
Tagged with: