[Skip to main content](#vessel-content)

#   Reference Parent Product

##

- **[Zeon](/forum/user/3310-zeon "View Zeon's Profile")**
- [![Zeon's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/3310-zeon "View Zeon's Profile") Topic Author
- [ Offline](/forum/user/3310-zeon)

Less More

- Posts: 3
- Thank you received: 0
-
-

15 years 3 months ago -  15 years 3 months ago [\#21223](#21223) by [Zeon](/forum/user/3310-zeon "View Zeon's Profile")  *[Reference Parent Product](/forum/4-how-to/21223-reference-parent-product#21223 "Hey guys, Quick question, I have modified the products-&gt;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:  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.")* was created by *[Zeon](/forum/user/3310-zeon "View Zeon's Profile")*

Hey guys,
Quick question, I have modified the products-&gt;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-&gt;element-&gt;images as $image){ echo '&lt;img src='.$this-&gt;lement-&gt;uploadFolder_url.$image-&gt;file_path.'" alt="'.$image-&gt;file_name.'" /&gt;'; }

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 3 months ago by [Zeon](/forum/user/3310-zeon "View Zeon's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIxMjIzLXJlZmVyZW5jZS1wYXJlbnQtcHJvZHVjdD90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

15 years 3 months ago [\#21238](#21238) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Reference Parent Product](/forum/4-how-to/21223-reference-parent-product#21238 "Hey guys, Quick question, I have modified the products-&gt;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:  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.")*

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-&gt;images)){ block).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIxMjIzLXJlZmVyZW5jZS1wYXJlbnQtcHJvZHVjdD90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Zeon](/forum/user/3310-zeon "View Zeon's Profile")**
- [![Zeon's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/3310-zeon "View Zeon's Profile") Topic Author
- [ Offline](/forum/user/3310-zeon)

Less More

- Posts: 3
- Thank you received: 0
-
-

15 years 3 months ago [\#21247](#21247) by [Zeon](/forum/user/3310-zeon "View Zeon's Profile")  Replied by *[Zeon](/forum/user/3310-zeon "View Zeon's Profile")* on topic *[Re: Reference Parent Product](/forum/4-how-to/21223-reference-parent-product#21247 "Hey guys, Quick question, I have modified the products-&gt;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:  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.")*

**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-&gt;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](http://sway.net.nz/new/index.php/products/tio-pablo/product/show/6-tortillas-12-pack)

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIxMjIzLXJlZmVyZW5jZS1wYXJlbnQtcHJvZHVjdD90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

15 years 3 months ago [\#21257](#21257) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Reference Parent Product](/forum/4-how-to/21223-reference-parent-product#21257 "Hey guys, Quick question, I have modified the products-&gt;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:  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.")*

Ok, I see.

The main product images should be in $this-&gt;element-&gt;main-&gt;images

The code $this-&gt;lement-&gt;uploadFolder_url is not correct and it should be $this-&gt;image-&gt;uploadFolder_url

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzIxMjIzLXJlZmVyZW5jZS1wYXJlbnQtcHJvZHVjdD90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.073 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
