Jump to content
Zappo

[Contribution] Option Types v2

Recommended Posts

hello zappo,

 

i would like to make a thumbnail image of the uploaded picture to appear in the shopping cart instead of the link to it

 

i wonder if you could point me into direction how can i acieve this

 

thanks

valerif

Share this post


Link to post
Share on other sites

hello zappo,

 

i would like to make a thumbnail image of the uploaded picture to appear in the shopping cart instead of the link to it

 

i wonder if you could point me into direction how can i acieve this

 

thanks

valerif

 

I'm sorry for not being Zappo, but what you want is not hard to do

 

In file shoppin_cart.php find the lines

         if (file_exists($imageDir.$products[$i][$option]['products_options_values_name'])) {
           $image_link1 = '<a href="' . $imageDir . $products[$i][$option]['products_options_values_name'] . '">';
           $image_link2 = tep_image(DIR_WS_ICONS . 'view.gif') . '</a>';
         }

 

Add one more tag, that calls the actual image, so that everything looks like this

         if (file_exists($imageDir.$products[$i][$option]['products_options_values_name'])) {
           $image_link1 = '<a href="' . $imageDir . $products[$i][$option]['products_options_values_name'] . '">';
           $image_link2 = tep_image(DIR_WS_ICONS . 'view.gif') . '</a>';
    $image_show = tep_image($imageDir . $products[$i][$option]['products_options_values_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); 
         }

 

I added $image_show, you can call it as you like

 

Last step is to output $image_show somewhere, for examle like this, but thats up to you (ofcourse you would remove image link 1 and 2, or you leave it to have a larger preview, or whatever

         $products_Options .= '<div class="optioncart">' . $products[$i][$option]['products_options_name'] . ': ' . $image_link1 . $products[$i][$option]['products_options_values_name'] . $image_link2 . $Option_Price . $image_show . '</div>';

 

Have a nice day

 

EDIT: Disregard my div's and classes,just find the similar line in your file

Edited by multimixer

Share this post


Link to post
Share on other sites

This downloads a zip file with zero bits.

Can you check the download file, please.

Ignore this - it was stupid Zone Alarm.

Edited by IamAlta

Share this post


Link to post
Share on other sites

This downloads a zip file with zero bits.

Can you check the download file, please.

Ignore this - it was stupid Zone Alarm.

It wasn't zone alarm. I can download other add ons.

I get a zero byte file named null_1_2_3_4_5_6_7_8_9.zip

What's up?

Share this post


Link to post
Share on other sites

I'm sorry for not being Zappo, but what you want is not hard to do

 

In file shoppin_cart.php find the lines

         if (file_exists($imageDir.$products[$i][$option]['products_options_values_name'])) {
           $image_link1 = '<a href="' . $imageDir . $products[$i][$option]['products_options_values_name'] . '">';
           $image_link2 = tep_image(DIR_WS_ICONS . 'view.gif') . '</a>';
         }

 

Add one more tag, that calls the actual image, so that everything looks like this

         if (file_exists($imageDir.$products[$i][$option]['products_options_values_name'])) {
           $image_link1 = '<a href="' . $imageDir . $products[$i][$option]['products_options_values_name'] . '">';
           $image_link2 = tep_image(DIR_WS_ICONS . 'view.gif') . '</a>';
    $image_show = tep_image($imageDir . $products[$i][$option]['products_options_values_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); 
         }

 

I added $image_show, you can call it as you like

 

Last step is to output $image_show somewhere, for examle like this, but thats up to you (ofcourse you would remove image link 1 and 2, or you leave it to have a larger preview, or whatever

         $products_Options .= '<div class="optioncart">' . $products[$i][$option]['products_options_name'] . ': ' . $image_link1 . $products[$i][$option]['products_options_values_name'] . $image_link2 . $Option_Price . $image_show . '</div>';

 

Have a nice day

 

EDIT: Disregard my div's and classes,just find the similar line in your file

thanks very much for the help,

the code works fine.

i have one more question. the image that has been uploaded can be seen only when it has been uploaded when the user has logged into their account. is it possible to make it visible even if the user has not been logged into its account?

thanks again

valerif

Share this post


Link to post
Share on other sites

Hi everyone, i didnt know where else to ask this so i'm going to ask it here. This contibution works great but there is one snag, in the "admin/orders.php", "admin/invoice.php" and "admin/packingslip.php" the order of the options shown dont seem to be in particular order. Is there a way to correct this and order it in the using the sort order number?

 

Thanks for your help and thanks again for the contibution.

 

Zappo, do you have a donate page?

Share this post


Link to post
Share on other sites

Hi,

I added the add-on Option Values to tie different attributes to my products.

This works fine for checkboxes, radio bottons, dropdown-menus but not for the text input fields.

I know I must have done something wrong but I have been comparing files and I cannot find anything. Can someone please point me in the right direction (give me a hint on where the error might be).

 

The text input box looks like it is duplicated, I get two boxes with slightly different appearance.

See this image, My link

 

When I view the source from the browser the part for text box looks like this:

 

<td class="main"><input type="text" name="id[txt_11]" id="id[txt_11]" size="0" maxlength="0"

value=""onkeydown="textCounter(this,'progressbar_11',0)"

onkeyup="textCounter(this,'progressbar_11',0)"

onfocus="textCounter(this,'progressbar_11',0)">   <div id="counterbar_11" class="bar"><div id="progressbar_11" class="progress"></div></div>

<script>textCounter(document.getElementById("id[txt_11]"),"progressbar_11",0,"counterbar_11")</script></td>

 

 

An error message occurs "Invalid argument" product_info.php, line 20, char 5.

 

Line 19 to 23 contains this:

 

if (linecounter) {

document.getElementById(counter).style.width = parseInt((fieldWidth*percentage)/100)+"px";

document.getElementById(linecounter).style.width = parseInt(fieldWidth)+"px";

document.getElementById(counter).innerHTML="<nobr>Max: "+percentage+"% - ("+charcnt+"/"+maxlimit+")</nobr>";

} else {

 

Where should I start? Pls, let me know if further info is needed.

Share this post


Link to post
Share on other sites

i have one question about uploading images

 

the image that has been uploaded and can only be seen in the shopping card when the user has logged into their account

 

is it possible to make it visible in the shopping cart even if the user has not been logged into their account?

 

valerif

Share this post


Link to post
Share on other sites

This post is directed towards MultiMixer. Sorry if this isn't where it should be, I couldn't find a thread about MM's modification to this contribution.

 

I went through the modification for Per unit or Per item, and most of it went reasonably well, until I came to #12, includes/classes/shopping_cart.php

 

The SQL queries for $attribute_price_query in my file didn't match the 'find' code you had included. In fact, many things in this file were different. The file was an unmodified copy from the Option Types v2.1.3 install. I also checked an old vanilla OSC 2v2rc2 install, and the file there doesn't match up either. I get the general idea of what is supposed to be happening there, but from what I can see, the code surrounding the changes to the attributes price section of the calculate function don't work with the code supplied in the directions. For example, $n is never used anywhere but in the replacement code, it's never assigned a value.

 

I don't know if maybe I have a different version of the file, or what's going on. I've included a dropbox link below, if you'd like to take a peek at it, maybe you could shed some light on the problem. This is the condition the file was in before I tried to apply instruction #12.

 

Thanks :)

 

http://dl.dropbox.com/u/6365460/shopping_cart.php

Share this post


Link to post
Share on other sites

I think I've got this working just through brute force, but I'm still curious why my file was so different.

 

I'm also interested in valerif's question too, I'm going to take a shot at that also.

Share this post


Link to post
Share on other sites

Sorry to post yet again. I wish I could edit my old posts.

 

Anyway, the next big thing on my list is to be able to control the sort order of the options on the items in the shopping cart. Is there any way to do this? The code for the contribution on the shopping cart page seems to be defeating me no matter which way I try to sort it.

Share this post


Link to post
Share on other sites

Sorry to post yet again. I wish I could edit my old posts.

 

Anyway, the next big thing on my list is to be able to control the sort order of the options on the items in the shopping cart. Is there any way to do this? The code for the contribution on the shopping cart page seems to be defeating me no matter which way I try to sort it.

 

Hi

 

Did you succeed to merge the includes/classes/shopping_cart.php? If not, or if you want to compare complete files, I can send you a copy of the file, as I use it, it's to big to post it here

 

Regarding sort order of the options and image preview if not logged in, I'll try to take a look and post back here

Share this post


Link to post
Share on other sites

Hi

 

Did you succeed to merge the includes/classes/shopping_cart.php? If not, or if you want to compare complete files, I can send you a copy of the file, as I use it, it's to big to post it here

 

Regarding sort order of the options and image preview if not logged in, I'll try to take a look and post back here

 

Multimixer,

 

No, actually I didn't get the merge to work cleanly. PHP isn't my strongest language, but I managed to modify the surrounding code needed to make it work in the end, and it all seems to be working fine now. I suppose it would be best to see your copy of the file though, to make sure I didn't miss anything important. My file seemed to be different where the while statements that generated the values for $n simply didn't exist, and the variables containing the SQL results were only storing a single row of data, so I needed to turn them into arrays.

 

I look forward to hearing your suggestion on the option sort on the shopping cart page. I've modified the code to show a thumbnail of the image the customer uploaded in the shopping cart page (and later found your post on how to do that step by step >.<). The problem is, now that image pushes all of the other options text around. I'd like to at least force the uploaded image option to the top, but it would be best if I could get them to follow the 'products_options_order' from the products_options table.

 

Thanks for the help!

Edited by zaaephod

Share this post


Link to post
Share on other sites

Hello,

 

I have option types running pretty well but have an issue with the image upload. The images upload fine to the images folder but when it is passed to the checkout and customer order status I cannot see the option to view the image (the little eyeball) or the file path. Has anyone run into this before?

 

Thanks for the help.

Share this post


Link to post
Share on other sites

... but when it is passed to the checkout and customer order status I cannot see the option to view the image (the little eyeball) or the file path...

 

What do you mean with this? Where exactly do you expect to see something?

Share this post


Link to post
Share on other sites

I think he's talking about when the item is in the cart. If the customer has uploaded an image, there will be a little link with an eyeball that can be clicked to view the uploaded image. This will not appear if the customer is not logged in, is it not showing up even when logged in?

 

Once the customer logs in, the image should be moved from the temp folder to uploads, and from then on, you should see the little eyeball.

 

Being able to see the link when the customer isn't logged in is one of the things people have been hoping for, myself included.

Edited by zaaephod

Share this post


Link to post
Share on other sites

What do you mean with this? Where exactly do you expect to see something?

 

Looking at the preview images it looks like it shows the file path. Something to indicate to the cart manager the file name and where to download it. I wasn't sure if this module allows the cart admin to click a link and download the uploaded image. I have attached the screen shot that shows the path to the Upload file in it.ShoppingCart.jpg

Share this post


Link to post
Share on other sites

Looking at the preview images it looks like it shows the file path. Something to indicate to the cart manager the file name and where to download it. I wasn't sure if this module allows the cart admin to click a link and download the uploaded image. I have attached the screen shot that shows the path to the Upload file in it.

 

What you have in your image is the shopping cart page, thats the customer point of view. If customer logged in, he has a image preview, if not, there is no preview, just the image name.

 

There is no path to the image, it is the image name, with a prefix, given by the script, to make each image unique. All uploads are stored in folder images/uploads.

 

There is no option right now for the admin to download the uploaded file, you need to go to the server to take it from there

Edited by multimixer

Share this post


Link to post
Share on other sites

What you have in your image is the shopping cart page, thats the customer point of view. If customer logged in, he has a image preview, if not, there is no preview, just the image name.

 

There is no path to the image, it is the image name, with a prefix, given by the script, to make each image unique. All uploads are stored in folder images/uploads.

 

There is no option right now for the admin to download the uploaded file, you need to go to the server to take it from there

Okay that is making more sense. Should the admin be able to see the upload file name, right now this is all they see, no image path:

 

1 x Product 1

- Special Instructions: Test

- Text Area: Test

- Font: Aerial

- Size: 4x7

- Layout: Layout1

Share this post


Link to post
Share on other sites

Okay that is making more sense. Should the admin be able to see the upload file name, right now this is all they see, no image path:

 

1 x Product 1

- Special Instructions: Test

- Text Area: Test

- Font: Aerial

- Size: 4x7

- Layout: Layout1

 

After testing I don't see the image path as a customer when I am logged in and checking out, is that an error on the install possibly?

Share this post


Link to post
Share on other sites

After testing I don't see the image path as a customer when I am logged in and checking out, is that an error on the install possibly?

 

You will never see the image path, this I told you. What you see, as a customer, is the image name + a preview link in case the customer is logged in

 

From the admin side you see the image name, so you go to the server and take it from there

 

I have no idea if you made an error in the installation or not. You list various options (ie - Special Instructions: Test), that do not refer to the upload option type. Can you please be specific and post exactly what you see printed on the screen when you upload an image?

1) In shopping cart I see: 1_019-monarch.jpg (this we know from your previous post)

2) In order history I see: ....

3) In admin I see : ...

 

(please do not post a image again)

Share this post


Link to post
Share on other sites

You will never see the image path, this I told you. What you see, as a customer, is the image name + a preview link in case the customer is logged in

 

From the admin side you see the image name, so you go to the server and take it from there

 

I have no idea if you made an error in the installation or not. You list various options (ie - Special Instructions: Test), that do not refer to the upload option type. Can you please be specific and post exactly what you see printed on the screen when you upload an image?

1) In shopping cart I see: 1_019-monarch.jpg (this we know from your previous post)

2) In order history I see: ....

3) In admin I see : ...

 

(please do not post a image again)

 

I understand you won't see the path. We just need to see the file name. It doesn't show.

 

1) In shopping cart I see: no image name

2) In order history I see: no image name

3) In admin I see : no image name

 

It is like it is not getting passed through the process but the image is getting uploaded.

Share this post


Link to post
Share on other sites

On the image you had posted earlier, I can see the monarch butterfly image name in the shopping cart. If it's not showing up anywhere else, then it probably is an install problem. I'm using the same contribution on a semi-fresh install of OSC, and I can see the uploaded image name in my admin section under the order.

Share this post


Link to post
Share on other sites

On the image you had posted earlier, I can see the monarch butterfly image name in the shopping cart. If it's not showing up anywhere else, then it probably is an install problem. I'm using the same contribution on a semi-fresh install of OSC, and I can see the uploaded image name in my admin section under the order.

 

Thanks zaephod.

 

I agree, I am going back to the drawing board and comparing the files. It is working along STS so I am sure I missed something.

 

Thanks for the input.

Share this post


Link to post
Share on other sites

Thanks zaephod.

 

I agree, I am going back to the drawing board and comparing the files. It is working along STS so I am sure I missed something.

 

Thanks for the input.

Just an aside,

 

We had to comment our this code in html_output for the add to cart function to work at all.

 

$sts->image($src);

 

If it is not commented out we receive this error:

 

Fatal error: Call to a member function image() on a non-object in /html/catalog/includes/functions/html_output.php on line 78

 

Has any one seen a conflict with Option Types V2 and STS?

Edited by rngeer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×