1

F.y.i. The website I'm making is for buying trips on a sailboat.

My upsells file shows the upsell items that are added in the admin (like the upsells file would normally do). The product variable is 'created' like this:

<?php
foreach ($this->getItemCollection()->getItems() as $_link):
// where $_link contains all the product options
endforeach
?>

Later, I have an attribute called 'period' (a select) which shows the period when the ship sets sail.

<?php echo $_link->getAttribute('period'); ?>

Problem, it returns 'null', why?

1

Instead of

<?php echo $_link->getAttribute('period'); ?>

If the attribute is of type select then use :

<?php echo $_link->getAttributeText('period'); ?>

If the attribute is of type text than use:

<?php echo $_link->getData('period'); ?>

OR

<?php echo $_link->getPeriod(); ?>
  • Yes! Thanks alot! The first one returned the select text (forgot to mention that). – Maarten Wolfsen Nov 7 '16 at 13:07

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.