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

Customized Product Options

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 10-26-2005, 08:09 PM
 
jtoth jtoth is offline
 

Newbie
  
Join Date: Oct 2005
Posts: 4
 

Default Customized Product Options

I made this mod (v 4.0.16) as a client wanted only a few categories to have a certain type of option. The client also the options displayed as radio buttons with an image. I did not want to mod the Produce Options module directly as the cliented needed it for all other products. This mod does the trick if you don't mind the manual update. For those interested in having something like this integrated into the admin, it can be done as well with some extra work. (replace 'skin1' with your actual skin dir):

1. Create a new product, ensure it is disabled and label accordingly so you know this is your pseudo product. Next add options as you would a regular product, adding all the options you would like. Note the class ID number.

2. Access database directly or through phpMyAdmin. Browse the table x_cart_class_options and you will see all the options you created, associated with the class ID you noted from step #1. Copy down each optionid for this particular class. Next, browse the xcart_categories table and note each categoryid that you want this product option to show up in.

3. Lets create the .tpl for our new option look. Create a new file in /skin1/customer/ ... name it anything but ensure it has the .tpl extension. It should look like the following, replace 60 with your classID, each value with the optionID you got from the database, and replace images as necessary:

Code:
{* Custom Product Options *} <tr> <td valign="middle">{$lng.lbl_custom_option}</td> <td> <table width="100%"> <tr> <td align="center"><input type="radio" id="po60" name="product_options[60]" value="199" /> Gold [img]/shop/images/ring_temp.jpg[/img]</td> <td align="center"><input type="radio" id="po60" name="product_options[60]" value="200" /> Bronze [img]/shop/images/ring_temp.jpg[/img]</td> <td align="center"><input type="radio" id="po60" name="product_options[60]" value="201" /> Silver [img]/shop/images/ring_temp.jpg[/img]</td> </tr> </table> </td> </tr>

** Also ensure you create a language variable for the label used above

4. We need to register the strstr() PHP function in /product.php so Smarty can access it in our .tpl file (someone please let me know if Smarty already has this functionality!)

Code:
# Add a custom function $smarty->register_function('strstr', 'strstr');

5. Open /skin1/customer/main/product.tpl ... and include the file from Step 3 just as you would any other .tpl file. I placed mine as follows (you can put it anywhere), and it will only show for a category which is under one of my root categories (24:


Code:
<TR><TD class="Line" height="1" colspan="2">[img]{$ImagesDir}/spacer.gif[/img]</TD></TR> <TR><TD colspan="2"></TD></TR> {**** Custom Product Options ****} {if strstr($current_category.categoryid_path, '248')} { include file=customer/loose_diamonds_settings.tpl"} {/if} {**** /Custom Product Options ****} {if $active_modules.Product_Options ne ""} { include file="modules/Product_Options/customer_options.tpl"} {/if}

I hope this helps someone ...
__________________
----------------------------------
Jeff
Thinkweb Media
X-Cart 4.0.16
PHP 4.3.2
Reply With Quote
  #2  
Old 12-05-2005, 09:17 AM
 
junaid junaid is offline
 

Advanced Member
  
Join Date: Dec 2003
Posts: 96
 

Default

thanks would give it a try.
much needed.
regards
Junaid
__________________
xcart 4.18 on linux
Reply With Quote
  #3  
Old 12-07-2005, 06:11 AM
 
xgarb xgarb is offline
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default

Cool, thanks for that...

I used a variation of your technique to get a hidden form field added to the product when it was added to the cart.

xgarb
__________________
Core version: 5.5.xx
Reply With Quote
  #4  
Old 06-07-2006, 07:52 PM
 
simco simco is offline
 

Advanced Member
  
Join Date: Sep 2005
Posts: 45
 

Default

I'd love to have this mod if it used checkboxes instead of radio buttons. Any chance of getting it changed to do so? I have an extreme need to list literally dozens of options for musical instruments and allow the customer to select multiple ones. The radio button is for either/or. I need a mod to allow 'and, and, and...'
__________________
www.templatedepot.com

PROGRAM: X-CART PRO
VERSION: Version 4.0.14
RUNNING ON: Linux Enterprise 3.0
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 02:15 AM.

   

 
X-Cart forums © 2001-2020