Post by Lembo » Tue Sep 10, 2019 10:50 am

Hello,
I was editing my "checkout" page to show product image or to be exact option image for products with options
it's working fine for products with 1 option,
but for products with multiple options sometimes it work and sometimes it automatically select the option that doesn't have image so it show the placeholder,
for example i have 3 options for a tshirt
1. Color with image of each color ( red - black - blue )
2. Size without image ( medium - large - xlarge )
3. material without image ( cotton - polyester )
it should show the color option image since it's the only option with images
but unfortunately sometimes it select size option or material option
so there is no image and instead there is a placeholder
i want to know how to check if the option has image or not,
i did a var_dump for $options and the result was

Code: Select all

array(15) { ["product_option_id"]=> string(3) "250" ["product_option_value_id"]=> string(3) "110" ["option_id"]=> string(2) "18" ["option_value_id"]=> string(3) "111" ["name"]=> string(17) "Size" ["value"]=> string(6) "xlarge" ["type"]=> string(5) "radio" ["quantity"]=> string(3) "100" ["subtract"]=> string(1) "1" ["price"]=> string(8) "100.0000" ["price_prefix"]=> string(1) "+" ["points"]=> string(1) "0" ["points_prefix"]=> string(1) "+" ["weight"]=> string(10) "0.00000000" ["weight_prefix"]=> string(1) "+" }
for example

Code: Select all

if($options has image){
show it's image
}elseif($options doesn't have image){
select another option 
}

Newbie

Posts

Joined
Wed Oct 17, 2018 9:56 am

Post by xxvirusxx » Tue Sep 10, 2019 1:25 pm

You want something like this old extension?

https://www.opencart.com/index.php?rout ... on_id=9459

Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - RO

Post by Lembo » Tue Sep 10, 2019 11:27 pm

xxvirusxx wrote:
Tue Sep 10, 2019 1:25 pm
You want something like this old extension?

https://www.opencart.com/index.php?rout ... on_id=9459
Yes but works for multiple options

Newbie

Posts

Joined
Wed Oct 17, 2018 9:56 am

Post by Lembo » Tue Sep 10, 2019 11:58 pm

Fixed by checking $product['option']

Newbie

Posts

Joined
Wed Oct 17, 2018 9:56 am
Who is online

Users browsing this forum: Google [Bot] and 9 guests