Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Product Options and Image previews - any ideas?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 05-16-2005, 05:14 AM
 
Jeffos Jeffos is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 38
 

Default

Hi

Looks like a great Mod. I do have a problem though. I cannot seem to be able to upload any photos on the Product variant new admin. The image thumb apears but when I click on the link :

The image will be saved as the product thumbnail after you click on "Save"

The image is not saved where it is supposed to. Not sure where to look. Itripple check all mods but without success.




Thank you very much for your great assistance.

J.
[img][/img]
__________________
Version 4.0.13
Reply With Quote
  #12  
Old 05-16-2005, 07:07 AM
 
ianwebster ianwebster is offline
 

Member
  
Join Date: Mar 2005
Posts: 14
 

Default

Hi Jeffos

I am not entirely clear on your exact problem -- please can you be more specific about what you are doing, what is working and what is not working (a bit more detail is required for me to understand)

Please also let me know if you are you using blobs or urls for your images. I am using urls to the images (which have already been uploaded to my server using ftp so I just select them). It may need to be tweaked if you are using blobs and/or you are uploading images from your local machine

thanks
Ian
__________________
4.0.12
Linux
Reply With Quote
  #13  
Old 05-16-2005, 10:17 AM
 
Jeffos Jeffos is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 38
 

Default

Hi Sorry for the lack of info.

Here is the printscreen of my product variant admin area


http://lightpointonline.com/X-Cart/noupload.jpg

I tried to upload photos from the three option I have at my disaposal. From my PC, Through Url and Pointing to the files on the server.

I tried to point to a photo to various directories in case there would be a htaccess issue with the files/master/ folder.

But the thumb of the image appears perfectly fine under the Preview Variant Image. But when trying to save it nothing happens.

Here is my product page as well

http://www.lightpointonline.com/X-Cart/product.php?productid=16134&cat=248&page=

Trying to display the variant image in the thumb underneath the main photo. From the Color Pull down menu. Just as your great mod is intended.

thank you very much for your help. I know it is probably a small stuff.
[/img]
__________________
Version 4.0.13
Reply With Quote
  #14  
Old 05-16-2005, 10:33 AM
 
Jeffos Jeffos is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 38
 

Default

Here is my skin1/modules/Product_Options/product_variants.tpl

Code:
{if $active_modules.Product_Options ne ""} {capture name=dialog} <TABLE border="0" {if $productids ne ''}cellspacing="0" cellpadding="4"{else}cellspacing="1" cellpadding="2"{/if} width="100%"> <FORM action="product_modify.php" method="POST" name="productvariantsform"> <INPUT type="hidden" name="section" value="{$section}"> <INPUT type="hidden" name="mode" value="product_variants_modify"> <INPUT type="hidden" name="productid" value="{$product.productid}"> <TR class="TableHead"> <TD colspan="2" align="center">{$lng.lbl_image}</TD> <TD width="40%">{$lng.lbl_variants}</TD> <TD>#VARIANT ID</TD> <TD>{$lng.lbl_price}</TD> <TD>{$lng.lbl_weight}</TD> <TD>{$lng.lbl_amount}</TD> <TD>{$lng.lbl_sku}</TD> </TR> {foreach from=$variants item=v} <TR{cycle name="classes" values=" class=TableSubHead,"}> <TD>[img]{$ImagesDir}/delete.gif[/img][img]{$ImagesDir}/change.gif[/img]</TD> <TD align="center">[img]{$xcart_web_dir}/image.php?productid={$product.productid}&variantid={$v.variantid}[/img]</TD> <TD><TABLE> {foreach from=$v.options item=o} <TR> <TD>{$o.class}:</TD> <TD>{$o.option_name}</TD> </TR> {/foreach} </TABLE></TD> <TD>{$v.variantid}</TD> <TD><INPUT type="text" size="8" name="vs[{$v.variantid}][price]" value="{$v.price}"></TD> <TD><INPUT type="text" size="5" name="vs[{$v.variantid}][weight]" value="{$v.weight}"></TD> <TD><INPUT type="text" size="5" name="vs[{$v.variantid}][avail]" value="{$v.avail}"></TD> <TD><INPUT type="text" size="20" name="vs[{$v.variantid}][productcode]" value="{$v.productcode}"></TD> </TR> {foreachelse} <TR> <TD align="center" colspan="5">{$lng.lbl_variants_list_empty}</TD> </TR> {/foreach} </TABLE> {if $variants ne ''} <INPUT type="submit" value="{$lng.lbl_update}"> <INPUT type="button" value="{$lng.lbl_rebuild_variants}" onclick="javascript: self.location='product_modify.php?section={$section}&productid={$product.productid}&mode=product_variants_rebuild';"> {/if} </FORM> {if $file_upload_data.imtype eq "T"} {include file="main/subheader.tpl" title="Preview variant image"} <TABLE border="0"> <TR> <TD>[img]{$xcart_web_dir}/image.php?productid={$product.productid}&variantid={$file_upload_data.variantid}&tmp=y[/img]</TD> </TR> <TR> <TD> {$lng.txt_save_thumbnail_note}</TD> </TR> </TABLE> {/if} {/capture} {include file="dialog.tpl" title=$lng.lbl_product_variants content=$smarty.capture.dialog extra="width=100%"} {/if}



and my modules/Product_Options/product_variants.php


Code:
<?php # # $Id: product_variants.php,v 1.1 2004/06/16 09:32:24 max Exp $ # # Product variants management # if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); } # # Product variants update # if($mode == 'product_variants_modify' && $variants) { foreach($variants as $k => $v) { db_query("UPDATE $sql_tbl[variants] SET weight = '$v[weight]', avail = '$v[avail]' WHERE variantid = '$k'"); db_query("UPDATE $sql_tbl[pricing] SET price = '$v[price]' WHERE variantid = '$k' AND productid = '$productid' AND quantity = 1 AND membership = ''"); if(!func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[variants] WHERE variantid = '$k' AND productcode = '$v[productcode]'")) db_query("UPDATE $sql_tbl[variants] SET productcode = '$v[productcode]' WHERE variantid = '$k'"); } $top_message["content"] = func_get_langvar_by_name("msg_adm_product_variants_upd"); $top_message["type"] = "I"; # Prepare for thumbnail updating func_set_product_by_variants($productid); $image_posted = func_check_image_posted($file_upload_data, "T"); $store_in = ($config["Images"]["thumbnails_location"] == "FS"?"FS":"DB"); if($image_posted) { # Get image content $image_data = func_get_image_content($file_upload_data, $productid); # Replace image (DB) or full path to image (FS) in the database if ($store_in == "FS") $image_data["image"] = addslashes($image_data["image"]); db_query("REPLACE INTO $sql_tbl[thumbnails] (productid, ".($store_in == "FS"?"image_path":"image").", image_type,variantid) VALUES ('$productid', '$image_data[image]', '$image_data[image_type]','".$file_upload_data["variantid"]."')"); } # # Rebuild product variants # } elseif($mode == 'product_variants_rebuild') { func_rebuild_variants($productid, true); $top_message["content"] = func_get_langvar_by_name("msg_adm_product_variants_rebuilded"); $top_message["type"] = "I"; } if(!empty($mode) && $REQUEST_METHOD=="POST" && $mode != 'return') { func_header_location("product_modify.php?productid=$productid&section=$section&mode=return"); } # # Assign the Smarty variables # $variants = func_get_product_variants($productid); if(!empty($variants)) $smarty->assign("variants", $variants); if($variantid && $variants) { foreach($variants as $v) { if($v['variantid'] == $variantid) { $variant = $v; break; } } if(!empty($variant)) $smarty->assign("variant", $variant); } ?>

They both should be the exact copy of the Mod. No change. Maybe I miss a > or somthing. But I get no error.

Let me know if you need to see any other of the modified files.

Thank you
__________________
Version 4.0.13
Reply With Quote
  #15  
Old 06-09-2005, 11:12 AM
 
dhurt dhurt is offline
 

Newbie
  
Join Date: May 2005
Posts: 8
 

Default

actually I'm trying to do something quite similar-
the thing is that on my site i use a detailed image for the product.tpl and not the thumbnail

what modifications to the posts above would i have to make to get this to work with replacing a "detailed image" ?
__________________
--
http://www.shopfosters.com
X-cart v4.0.14
Reply With Quote
  #16  
Old 06-09-2005, 01:58 PM
 
ianwebster ianwebster is offline
 

Member
  
Join Date: Mar 2005
Posts: 14
 

Default

Actually in my case I am also replacing a detailed image. Despite the terminology used by xcart to describe the images as "thumbnails", that does not mean you cannot use the "thumbnail" table to refer to large images. The reason for using the thumbnail table in this mod (rather than the detailed images) is that most of the code is already there by default in product.tpl

In reality, since the javascript function checkoptions() is always called on loading the product page, you could actually use a spacer.gif (with width and height attributes set) as long as its id=product_thumbnail .....and the javascript will automatically replace this with the image for the default product variant - NOTE if you do this, then ALL your product variants must have an image in the thumbnail table - I have instead decided to use the first detailed image as the product default image (that way I dont need to set the variant thumbnails iunless they are relevant)
__________________
4.0.12
Linux
Reply With Quote
  #17  
Old 07-27-2005, 06:28 PM
 
greggo greggo is offline
 

Member
  
Join Date: Oct 2002
Posts: 22
 

Default Main Image?

Quote:
Originally Posted by ianwebster
I have instead decided to use the first detailed image as the product default image (that way I dont need to set the variant thumbnails iunless they are relevant)

How do you do this?

Version 4.0.14 Gold
Reply With Quote
  #18  
Old 07-29-2005, 06:04 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

I got it working in 4.0.14 here: http://www.goldmisers.com/product.php?productid=288&cat=29&page=1
Thanks ianwebster (somebody should upgrade this guy from nube to ACE!) You got my vote for mod of the year DUDE!
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #19  
Old 10-08-2005, 05:57 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Ian definitely gets my vote for mod of year. Not only does he offer the end user solution, but the admin config. as well. Although it is still easy to use phpMyAdmin to do an insertion into the thumbnail tpl for the variant linked images, one can imagine the usage of a client with the admin. portion of the mod.

I'm sure if folks saw Ian's sample- this would be one of the hot ones...

I used it in combination with my variant auto-generated color swatches/images. Anyone know what to use for the equivalent <A HREF> to use do the same as the dropdiown options?

Thanks mate! Makes me think twice about offering anything for sale mod-wise.

- Mike
__________________
4.1.9
Reply With Quote
  #20  
Old 10-30-2005, 11:40 PM
 
jcnelson jcnelson is offline
 

Newbie
  
Join Date: Feb 2003
Posts: 6
 

Default

Jeffos, did you ever figure out what needed to be changed on yours to get it to work? I am seeing a similar result. Everything looks as if it should work, however I get the buttons for Delete Image and Change Image where the variant image should be inserted.

This is store is currently using 4.0.13
__________________
Version 4.15
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:59 PM.

   

 
X-Cart forums © 2001-2020