lain
Members-
Posts
51 -
Joined
-
Last visited
lain's Achievements
Newbie (1/14)
9
Reputation
-
Hi, I found this thread in google trying to hide/exclude some CMS pages from prestashop in-page sitemap (not sitemap.xml) If somebody reach this thread as I did, here is the solution in PS 1.4.5.1 in yourtheme/sitemap.tpl change {foreach from=$categoriescmsTree.cms item=cms name=cmsTree} <li><a href="{$cms.link|escape:'htmlall':'UTF-8'}" title="{$cms.meta_title|escape:'htmlall':'UTF-8'}">{$cms.meta_title|escape:'htmlall':'UTF-8'}</a></li> {/foreach} to {foreach from=$categoriescmsTree.cms item=cms name=cmsTree} {if $cms.id_cms==1} {else} <li><a href="{$cms.link|escape:'htmlall':'UTF-8'}" title="{$cms.meta_title|escape:'htmlall':'UTF-8'}">{$cms.meta_title|escape:'htmlall':'UTF-8'}</a></li> {/if} {/foreach} where $cms.id_cms==1 is the CMS page´s ID you want to exclude for example, to exclude CMS 1,2 and 3 it would be {if $cms.id_cms==1 || $cms.id_cms==2 || $cms.id_cms==3}
-
Exclude page from sitemap (sitemap.php)
lain replied to yans's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
Hi, I found this thread in google trying to hide/exclude some CMS pages from prestashop in-page sitemap (not sitemap.xml) If somebody reach this thread as I did, here is the solution in PS 1.4.5.1 in yourtheme/sitemap.tpl change {foreach from=$categoriescmsTree.cms item=cms name=cmsTree} <li><a href="{$cms.link|escape:'htmlall':'UTF-8'}" title="{$cms.meta_title|escape:'htmlall':'UTF-8'}">{$cms.meta_title|escape:'htmlall':'UTF-8'}</a></li> {/foreach} to {foreach from=$categoriescmsTree.cms item=cms name=cmsTree} {if $cms.id_cms==1} {else} <li><a href="{$cms.link|escape:'htmlall':'UTF-8'}" title="{$cms.meta_title|escape:'htmlall':'UTF-8'}">{$cms.meta_title|escape:'htmlall':'UTF-8'}</a></li> {/if} {/foreach} where $cms.id_cms==1 is the CMS page´s ID you want to exclude for example, to exclude CMS 1,2 and 3 it would be {if $cms.id_cms==1 || $cms.id_cms==2 || $cms.id_cms==3} -
[SOLUCIONADO] Cantidades de producto con multiplos de 6, 3 o x
lain replied to ander46's topic in Discusión general
Hola, la solución aquí: http://www.prestashop.com/forums/topic/254564-meter-productos-en-el-carrito-en-multiplos-de-x-prestashop-1451 -
Hola, esta es la solución que he empleado en 1.4.5.1 dentro de CartController.php en la línea 173~ después de: if (!sizeof($this->errors)) { if ($add AND $qty >= 0) { y antes de: /* Product addition to the cart */ if (!isset(self::$cart->id) OR !self::$cart->id) { añadimos esto: // inicio modificación if ((int)$idProductAttribute) $minimal_quantity = Attribute::getAttributeMinimalQty((int)$idProductAttribute); else $minimal_quantity = $producToAdd->minimal_quantity; if ($qty%$minimal_quantity!= 0) { // $this->errors[] = Tools::displayError('You can only only add this item to your cart with a quantity multiple of ').' '.$minimal_quantity; die('{"hasError" : true, "errors" : ["Este producto únicamente puede ser añadido al carrito en cantidades multiplos de '.$minimal_quantity.'. Por ejemplo: '.($minimal_quantity).', '.($minimal_quantity*2).', '.($minimal_quantity*3).', '.($minimal_quantity*4).'... "]}'); } // fin modificación ahora en "themes/laplantillaqueusemos/js/product.js cambiar: if ($('#quantity_wanted').val() < minimal_quantity) por: // código viejo // if ($('#quantity_wanted').val() < minimal_quantity) if ($('#quantity_wanted').val()%minimal_quantity!=0) Si se quiere el mensaje de "la cantidad múltiplo de..." en un site multi idioma habrá que emplear '.Tools::displayError('Error in English.').' y agregar las correspondientes traducciones
-
Show original price AND discounted price when in customer group
lain replied to davidchr's topic in Core developers
Hello, what I did was to create a variable in frontcontroller.php which contains group id. Then in TPL files add an IF to check if customer belongs certain group and show custom content like percent group discount, stroked prices or anything For example, I only have 1 special group, so to show old price only on this group I use code above and this {convertPrice price=$product.price_without_reduction} in product-list.tpl to show group prices before discount. I could add -10% label too. On the same way, it is possible to add an IF ELSEIF for any groups you want and add custom "-10%", "-15%" labels. Anyway, I guess PS saves group discounts somewhere and you could get it using code. -
[solved] Use variable from function inside another function
lain replied to lain's topic in Core developers
Thank you vekia, your idea fixed my problem, using shop database and PS_CONFIGURATION table to save variable value temporarily was the solution. Thank you again -
[solved] Use variable from function inside another function
lain replied to lain's topic in Core developers
Anyway, someone knows how to do that? call a function, modify a variable and use this variable in another function -
[solved] Use variable from function inside another function
lain replied to lain's topic in Core developers
It doesnt sound dumb, functions are called separately, I am the dumb I will try to explain what I am doing: I want to use mail::send when a customer is changed from inactive to active when you edit a customer, function one is executed to print in screen customer fields, I try to save customer status into a variable. When you save from editing customer its executed function two, here I want to compare old customer status(variable from function one) and actual customer status and if it changes... { .. mail::send .. } -
[solved] Use variable from function inside another function
lain replied to lain's topic in Core developers
Hello again vekia, first of all thank you for your help defining the variable in function __construct allows me to use variable in function one and function two, thats ok BUT variable can not be modified in function one and get this modified value from function two. If function one modifies variable value, when function two call this variable, it has the original value from function __construct, not the value from function one. I hope you can understand me -
[solved] Use variable from function inside another function
lain replied to lain's topic in Core developers
anyway it doesnt work function one() { $this->variableSample = "asdf"; echo $this->variableSample; } function two() { $secondvar = $this->variableSample; echo $this->variableSample; echo $secondvar; } echo from first function is showed but echo´s from second function arent -
[solved] Use variable from function inside another function
lain replied to lain's topic in Core developers
Hello vekia, thanks for answering I have tried $this->variableSample="Sample text!"; and just used $variableSample in the same function or another function but unsuccessfully. $variableSample keeps empty -
[solved] Use variable from function inside another function
lain replied to lain's topic in Core developers
You are right. Sorry I am using 1.4.5.1 -
[solved] Use variable from function inside another function
lain replied to lain's topic in Core developers
Thank you Paul but the problem using $this->context->smarty->assign('variable', $variable); Is that I get an error: Fatal error: Call to a member function assign() on a non-object in W:\var\www\server\administrator\tabs\AdminCustomers.php on line 874 Some times I have used $smarty->assign('variable', $firstvariable); in "FrontController.php" to use $variable in tpl files, but in that case, from "AdminCustomers.php" I cant use $smarty->assign or $this->contest->smarty->assign. Anyway, as I said, I want to use $variable from function one() in function two() -
Hello, I am working in "AdminCustomers.php" trying to save a value in a variable from one function and use this variable/value in another function but unsuccessfully I tried using global $variable; public $variable; $smarty->assign('variable', $firstFunctionVar); $this->context->smarty->assign('variable',$firstFunctionVar); I am sure its a dummy thing. thank you
-
Well, it seems that files are bit different from 1.4.5.1(my version) to 1.5.x (your version) I have not any store running on 1.5.x so I cant test it but it looks that changing Tools::redirect('index.php?controller=authentication'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); to Tools::redirect('index.php?controller=authentication2'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); and then in "AuthController2.php" change the AuthControllerCore to AuthControllerCore2 and: public $php_self = 'authentication'; to public $php_self = 'authentication2'; etc... etc... But, as I said, its not tested on 1.5.x.