Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get product attribute color to show in shopping cart?


98stratos

Recommended Posts

Posted

I know there must a solution to this but I have not found it......

 

I have a product which is available in different colors, I have thumbnails of that particular product showing the available different colors.  And from the drop down menu is where a customer would choose the particular color they want to purchase, and once they click "add to cart" and proceed to checkout, the image that is there is the "main" logo for that product.  Not the thumbnail for the color attribute that they picked from the drop down menu.

 

I have narrowed down the code within the shopping_cart.php file....

<td align="center"><a class="right_20" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>'

How can I specify here for it to show the image that is associated with the attribute color that they want?

 

I hope I am not confusing.......and like I said I am sure there is an easy fix......am hoping someone know what it is.....

Posted

I have done various testing on this scenario and it seems the only way to get this done so that the customer will see the actual product they are purchasing is to have each individual color as a individual product.....

 

say for instance....

 

I am selling crankbaits......and for one crankbait there are 8 colors.....I have to add eight different products under that particular model of crankbait for the customer to see that specific color in their shopping cart.....

 

I used this idea by going to Bass Pro Shop's website and looking at the way they do it.....and they list every single color of a crankbait as a single product.....this is way too much in my opinion....

 

Isn't there a way to not have to list every single color as an individual product which enables the customer to see the actual attribute of the product they are purchasing once it arrives in the shopping cart?

 

there has to be a way......

Posted

For sure it's possible.  

 

Assuming you have just 1 level of options, you need to;

 

1.  set up some way to assign images to options, you can code this yourself, or find an addon.

2.  make up some code to swap out the "usual" image for the "option" image

-> probably in product_info so it looks cool

-> and in shopping cart

 

If you have more than 1 level of options (eg:  size [4 different images] and color [10 different images]  -- this is when it gets tricky).

 

So - yes - what you want is possible and is fairly straightforward if you think logically enough and know enough code to get it done.

 

Before you ask, that is the extent of the advice given, perhaps someone else will come up with the actual code you need.  

I don't do that.  I give pointers and then like to see others do it.  aka lazy.

Posted

OK......I have installed the addon "Options as Images", and after much modification I have got it "appearing and working" I am hoping the way it should.  I can update all information in regards to the attributes I specified for a product, including the image.

 

But, I am assuming that this addon really serves no purpose whatsoever cuz I am not seeing anything different.  The last thing I want to do is have someone "do the work" for me, I am familiar with all aspects of coding, but this one has really got me.

 

Was hoping this addon would do.......but like I said I do not see any results from the installation and configuration.....

 

burt, I like the "aka lazy".......lol

Posted

I wonder if Mr. Whitehead's product variants (whatever happened to it) may help you solve this problem. For me, I rewrote the backend and the frontend  to get the images working as well as integrated it into an ERP....a lot of work for sure....

Posted

 "Options As Images" addon

It should do is allow you to affix an image to a option value.  

It should then show that in Product Info when you make an option selection.

 

That's my understanding of it.  But I could be way off - I've never used that particular addon.

 

Here's a standard installation of Responsive along with a few code changes to show something close to what you want to do.

It is not something that could be shared, this is just to show that it is possible.

 

Posted

Would also have having the QTPro contrib affect this not working?  Pertaining to "Options as Images", I have everything enabled and specified images to particular attributes....but see nothing......

 

Have no idea.......lol

 

Nice vid btw

Posted

Well.......Options as Images was a total waste of time....although it works.....it was so far from what I was trying to do I dont even know what to say.....

 

keep on searching.....

Posted

If you don't have a way to link an image to an option ... then you'll need to think of some other way to do it.  Maybe you can shortcut it;

 

Let's say you have 

 

Color:

Blue

Red

Green

 

Now you create three image:

 

color-blue.png

color-red.png

color-green.png

 

Upload these.

 

Now in shopping_cart, iterate through the product->attributes and grab the name-value of the chosen attrib.  So, if they have color green in cart, you would end up doing

 

if (file_exists(name-value.png)) $image = name-value.png

 

name-value would obviously change based on whatever is in the cart.

 

And then instead of showing the usual image in the cart, show the $image

 

If you are able to think logically, that should not be too difficult.

Posted

burt,

 

  Thank you so much for your continued assistance and advice on this.  I clearly understand the base principles of what you said and I know where to implement the needed code changes to achieve what I am trying to do, but as you said, "If I am able to think logically", well.....I am not Vulcan...lol...more like Klingon.....

 

I have tried several attempts and get nothing but a white screen....but I will continue as your advice has rekindled the fire to get this done.....

 

thanks again.....

Posted

Ok.....I cannot figure this out.  I have tried and tried and tried.

 

I do know that this is the section of code in the shopping_cart.php file that includes the "main' image, but I cannot figure out how to tie the image to the attribute name....

<td align="center"><a class="right_20" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>

I know that below this code there is this:

$products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';

And this is the code that pulls the attribute information and places that info within the page itself....."color" and "name of color".  So, it is "$products[$i][$option]['products_options_values_name']" that shows me the attribute of the product. 

 

I was assuming that in the top code I have included where it states, "$products[$i] ['image']", this would be the small part to modify since this is where the image comes from. 

 

I just cannot figure out how to tie the two together.

 

I have tried the "if" statement in every way I can think of......but to no avail......

 

:wacko:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...