Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Questions (/forumdisplay.php?f=67)
-   -   Coupon Ends (if exists)? (/showthread.php?t=4591)

badnews June 2nd, 2011 07:04 AM

Coupon Ends (if exists)?
 
Is it possible to query coupon end date similar to the function for "Sale Price (if exists)" within product tags when editing a view in the factory?

Where exactly can one find this information to create their own php based arguments?

Thanks

Eric June 2nd, 2011 07:07 AM

Hi

Right now, there is no support for conditionals for coupon information. We plan on adding that in version 3.4.

Eric

badnews June 2nd, 2011 07:10 AM

Looking forward to it. Thanks for the super fast reply Eric.

badnews February 7th, 2012 05:29 PM

Alright. So how do i do it now :).

Eric February 7th, 2012 07:01 PM

Hi

You have access to the following variables within a Product detail or Product list module:

PHP Code:

$s->coupon_info($product'code');
$s->coupon_info($product'begin');
$s->coupon_info($product'end');
$s->coupon_info($product'restrictions'); 

Those are coupon code, coupon begin date, coupon end date and any coupon restrictions.

You can use those values in your own PHP conditionals.

Eric

badnews February 7th, 2012 07:02 PM

Great. Thanks!

bkozlowski June 6th, 2012 01:19 PM

Hi Eric,

I think I found the right thread for what i'm trying to do, but don't know very much php to implement it.

I'd like to ONLY show the "Coupon Code:" if the cell is greater than NULL?

If this is possible how would this look and where would we put it?

Thanks.

Eric June 6th, 2012 02:08 PM

Hi

You can do something like this:

PHP Code:

<?php if (trim($s->coupon_info($product'code')) != '') : ?>
    [coupon.code]
<?php endif; ?>


bkozlowski June 6th, 2012 02:32 PM

Thanks, Where should I put this?

Eric June 6th, 2012 02:33 PM

Quote:

Originally Posted by bkozlowski (Post 32421)
Thanks, Where should I put this?

Wherever you want the code to appear in your Views.

bkozlowski June 6th, 2012 02:40 PM

Worked like a charm! Thanks for your help.

bkozlowski June 7th, 2012 09:43 AM

Is it possible to modify this code in the following way?

Only show the "Coupon Code" unless the value is Null, if the value is Null then display the "Coupon End Date", if this value is also Null then display nothing.

Thanks

Eric June 7th, 2012 09:45 AM

Sure, just extend the if() statement:

PHP Code:

<?php if (trim($s->coupon_info($product'code')) != '') : ?>
    [coupon.code]
<?php elseif (trim($s->coupon_info($product'end')) != '') : ?>
    [coupon.end]
<?php endif; ?>


bkozlowski June 7th, 2012 09:45 AM

Ohh, is it also possible to change the format of the end date? Ex: 06-01-2012

bkozlowski June 7th, 2012 09:49 AM

Nice, I just started a PHP class so I can figure this stuff out myself lol. Appreciate your help!


All times are GMT -5. The time now is 01:27 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.