2

I want that for a specified period, the attribute is changed from yes to no. because someone has an idea?

This is my current code:

<?php if ($_product->getAttributeText(‘backthere’) == “Yes”): ?>
   <span class="backthere">Wieder da</span>
<?php endif; ?>

Thanks

  • i can't understand if yes it should display Wieder da Right – Magento 2 Nov 16 '15 at 12:05
  • Yes that's right. – user3778868 Nov 16 '15 at 12:06
  • $custom = Mage::getModel('catalog/product')->load($prod_id); $store_vies_val = $custom->getAttributeText('backthere'); if (($store_vies_val == 'Yes'){?> <span class="backthere">Wieder da</span><?php } – Magento 2 Nov 16 '15 at 12:10
  • Ok and where is the expiration date? – user3778868 Nov 16 '15 at 12:11
  • I guess what you are asking is to have 2 attributes here, one that holds value of Yes/No, and one that holds date on the basis of which you will decide expiration. Try configuring your code with that in mind and you might get the solution. – Prateek Nov 16 '15 at 12:59
1

You can achieve this by creating attributes with proper validation.
Refer new from and new to attributes or special price from and to attributes. Create date attribute and use that in a cron or just put a condition while rendering.

1

Ok thank you guys. I have solved it. Here is my solution:

<?php
    $now = date('Y-m-d');
    $wiederdaTo =  substr($_product->getData('wiederdadatum'),0,10);

    if (($now<=$wiederdaTo))
{?>
<span class="wiederda">Wieder da</span>
<?php }?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.