Adding text from variable to each Product Card

Open to all! Ask other shopowners for help.
Post Reply
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Adding text from variable to each Product Card

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Adding text from variable to each Product Card

Post 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.
radhavallabh
Senior Contributor
Posts: 466
Joined: Tue Oct 27, 2020 4:09 am
Phoenix Version: 1.1.0.6
Has thanked: 29 times
Been thanked: 3 times

Re: Adding text from variable to each Product Card

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply