Page 1 of 1

Adding text from variable to each Product Card

Posted: Sun Jul 14, 2024 4:58 am
by radhavallabh
Hi;
I am trying to add some text through a Variable in each product card;
Using 1.0.9.0;
The issue is the variables are displayed properly on each product except for the first product on the product_listing.php.
For some weird reason it is leaving out the very first product of the listing on each page.
I use below code to display it on product_card.php

Code: Select all

if ($product->get('has_attributes')){
		 echo $optext;
		 echo $valtext;
	 }
Can someone please help me fix this issue?
It may be funny but I tried using the form tag formula of adding a extra <form></form> and closing the above code in form tags as a hack but no avail.

Your help shall be deeply appreciated,
Thank you for your help in advance;
Regds./
radhavallabh

Re: Adding text from variable to each Product Card

Posted: Sun Jul 14, 2024 9:18 am
by ecartz
Are $optext and $valtext set at that point? That's the behavior that you'd get if set $optext and $valtext after that point in the iteration.

Re: Adding text from variable to each Product Card

Posted: Sun Jul 14, 2024 9:21 am
by radhavallabh
ecartz wrote: Sun Jul 14, 2024 9:18 am Are $optext and $valtext set at that point? That's the behavior that you'd get if set $optext and $valtext after that point in the iteration.
Hi dear they are set in the product_listing.php before this ...........
$card = [
'show_buttons' => true,
];............

Regds./
radhavallabh