Jump to content

[solved] Getting more data from the getRandomSpecial function?


Recommended Posts

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

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...