Daveriser Posted February 25, 2010 Share Posted February 25, 2010 Hey All,I'm trying to get the dates that a product is on special for, any ideas how I can do this? I began looking into the code and I couldn't see where this variable was. Any help would be greatly appreciated!This is the function I was looking at: static public function getRandomSpecial($id_lang, $beginning = false, $ending = false) { global $link, $cookie; $currentDate = date('Y-m-d'); $result = Db::getInstance()->ExecuteS(' SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, i.`id_image`, il.`legend`, t.`rate` Thank you!David Link to comment Share on other sites More sharing options...
Daveriser Posted February 26, 2010 Author Share Posted February 26, 2010 Any ideas?I've been so stumped on this. Our Client wants the specials module on the home page to say "While stocks last", or "Offer ends 14/02/2010", however I want to check the properties on the product itself, the product's 'available from' and 'available to' fields, if the fields are equal I will say "While stocks last" if they are different then I will put the 'offer ends' date in.I'm stumped with trying to figure out how I get php to give me those values from the getRandomSpecial function.Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
Daveriser Posted March 1, 2010 Author Share Posted March 1, 2010 *bumping*Forgive my bumping, I absolutely need a solution to this, and must do so until I find one. Link to comment Share on other sites More sharing options...
Daveriser Posted March 3, 2010 Author Share Posted March 3, 2010 *bumping* Link to comment Share on other sites More sharing options...
Daveriser Posted March 3, 2010 Author Share Posted March 3, 2010 Found a solution which took me ages to find yet so simple, found out that the $specials variable links in with the mySql database and I could simply append any variable from the database there.I simply added this code to the specials tpl file: {if $special.reduction_from == $special.reduction_to} While Stocks Last {else} {$special.reduction_to} {/if} Link to comment Share on other sites More sharing options...
Daveriser Posted March 3, 2010 Author Share Posted March 3, 2010 Is it possible to do something like this in the tpl file? { $myVariable = $special.reduction_from} Offer Ends {$myVariable} Right now nothing comes up if I use $myVariable but it does if I use $special.reduction_from, would anyone share light on this for me? Thanks. Link to comment Share on other sites More sharing options...
rocky Posted March 3, 2010 Share Posted March 3, 2010 I don't understand why you are copying the variable, since you can simply use {$special.reduction_from}, but if you must copy the variable, you should use the following code: {assign var='myVariable' value=$special.reduction_from} Link to comment Share on other sites More sharing options...
Daveriser Posted March 3, 2010 Author Share Posted March 3, 2010 Thanks rocky!I was hoping to see if I could change the displayed date format (from Y-m-d to d-m-Y) simply by using a new variable and changing it's values, do you know where I could find out more information on this scripting language to do such a thing?I know what it's like to have new users ask the most obviously answered questions, I appreciate your time. Link to comment Share on other sites More sharing options...
rocky Posted March 4, 2010 Share Posted March 4, 2010 Prestashop uses Smarty templating. It looks like there is a date_format modifier you can use here. Link to comment Share on other sites More sharing options...
Daveriser Posted March 4, 2010 Author Share Posted March 4, 2010 Got it working, appreciate your help Rocky. 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