Skip to main content

Reference Parent Product

More
15 years 2 months ago - 15 years 2 months ago #21223 by Zeon
Hey guys,
Quick question, I have modified the products->view file to enable a CSS based gallery for my products. However when a product ahs more than one variant, it will show the images in the variant's image list rather than the parents product. How can i call the main product's image when a variant is present? I'm currently using thise code:
Code:
foreach($this->element->images as $image){ echo '<img src='.$this->lement->uploadFolder_url.$image->file_path.'" alt="'.$image->file_name.'" />'; }

This works great when there are no variants but shows the variant's images rather than the primary product's images if a variant exists.
Last edit: 15 years 2 months ago by Zeon.

Please Log in or Create an account to join the conversation.

More
15 years 2 months ago #21238 by nicolas
If you don't want to display the variant images, you can just delete the variants images display block of code in that view (the whole if(!empty($variant->images)){ block).

Please Log in or Create an account to join the conversation.

More
15 years 2 months ago #21247 by Zeon
Replied by Zeon on topic Re: Reference Parent Product
nicolas wrote:

If you don't want to display the variant images, you can just delete the variants images display block of code in that view (the whole if(!empty($variant->images)){ block).


Hi Thanks for the reply. Oh I still want the variant images - what I really want is to be able to show one image for each variant next to the price and have 4-5 photos from the parent in a type of CSS based slideshow.

E.g. on here I have used CSS animations to make a slideshow:
sway.net.nz/new/index.php/products/tio-p.../6-tortillas-12-pack

But to show you the problem, this product has variants and thus when you call this->element-> images it overrules the 5 photos from the parent product:
sway.net.nz/new/index.php/products/tio-p...w/1-chocolate-azteca

Please Log in or Create an account to join the conversation.

More
15 years 2 months ago #21257 by nicolas
Ok, I see.

The main product images should be in $this->element->main->images

The code $this->lement->uploadFolder_url is not correct and it should be $this->image->uploadFolder_url

Please Log in or Create an account to join the conversation.

Time to create page: 0.213 seconds
Powered by Kunena Forum