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

Hide Product Options Title in Product Detail If No Options

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-16-2004, 02:13 AM
 
mikebo mikebo is offline
 

Advanced Member
  
Join Date: Feb 2004
Location: Ohio
Posts: 72
 

Default Hide Product Options Title in Product Detail If No Options

Hi

I'd like to hide the Options Title on my product detail page if there are no options available for the product. I've been able to locate the code related to this in product.tpl and customer_options.tpl however, I am not able to construct the if statement needed to do this (my knowledge of code is limited).

Since I have only one product with options (gift wrapping), to show the options title on each product detail page seems needless.

Any help would be appreciated and thanks in advance.
__________________
Mike
X-Cart Gold
Version 4.6.0 PHP 5.2.17
Reply With Quote
  #2  
Old 05-01-2004, 03:28 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

I got step 1 of this done, first take out:

Code:
<tr><td colspan=2> <font class=ProductDetailsTitle>{$lng.lbl_options}</font> </td></tr> <tr><td class=Line height="1" colspan=2>[img]{$ImagesDir}/spacer.gif[/img]</td></tr>

from customer/main/product.tpl

and put it in skin1/modules/Product_Options/customer_options.tpl

put it on top of the beginning of the section loop so it looks like this:

Code:
<tr><td colspan=2> <font class=ProductDetailsTitle>{$lng.lbl_options}</font> </td></tr> <tr><td class=Line height="1" colspan=2>[img]{$ImagesDir}/spacer.gif[/img]</td></tr> {section name=product_option loop=$product_options}

Doing this will only display the Options header if the customer_options.tpl is called.

The problem is, even if there are no product options, the customer_options.tpl will always be called and still display the Options header because of this code in product.tpl:

{if $active_modules.Product_Options ne ""}
{ include file="modules/Product_Options/customer_options.tpl"}
{/if}

If you check the Product Options module to be active in your admin section, the header will always show unless someone can come up with another if statement, like if product options greater than 0 or something, then show customer_options.tpl[/code]
Reply With Quote
  #3  
Old 05-01-2004, 04:22 PM
 
mikebo mikebo is offline
 

Advanced Member
  
Join Date: Feb 2004
Location: Ohio
Posts: 72
 

Default

Hi Xcell,

I appreciate your respone. I was able to get this figured out a few days ago. In my case the only product in our inventory with the need for options is gift wrapping. What I ended up doing is this;

In skin1/customer/main/product.tpl around line 51,

I replaced this;
{if $active_modules.Product_Options ne ""}
{ include file="modules/Product_Options/customer_options.tpl"}

with this;
{if $active_modules.Product_Options ne "" and $product.productcode eq "ZWRAP"}
{ include file="modules/Product_Options/customer_options.tpl"}

It seems to work well but could be a problem for those who have alot of products with options.

Again, thanks for your help with this. I should have posted back to this thread when I figured out a solution.


Mike
__________________
Mike
X-Cart Gold
Version 4.6.0 PHP 5.2.17
Reply With Quote
  #4  
Old 05-01-2004, 06:55 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

Hi Mike,

Thanks for your response, your solution gave me an idea to create a mod for users who need to hide the options header for more than one item.

First take out:

Code:
<tr><td colspan=2> <font class=ProductDetailsTitle>{$lng.lbl_options}</font> </td></tr> <tr><td class=Line height="1" colspan=2>[img]{$ImagesDir}/spacer.gif[/img]</td></tr>

from skin1/customer/main/product.tpl

and then paste on top in skin1/modules/Product_Options/customer_options.tpl

Then, using phpmyadmin or xcarts patch/upgarde thingy; create a new field called od, type: char, lenght/values: 1, null: no
in the table xcart_products

then edit include/product_modify.php:

find the line

Code:
# # Update product data # db_query("update $sql_tbl[products]
and add: od='$od' after any of the queries, i put mine after brand='$brand'

then go to skin1/main/product_modify.tpl

and add this:

Code:
<tr> <td class=ProductDetails height="11">Options Display</td> <td class=ProductDetails height="11"> <select name=od> <option value='N' {if ($product.od eq 'N')} selected {/if}>{$lng.lbl_no}</option> <option value='Y' {if ($product.od eq 'Y')} selected {/if}>{$lng.lbl_yes}</option> </select> </td> </tr>

you can put this anywhere, it is for your use to mark the item to display the options or not, I put mine after the free shipping option.

then finally, go back to skin1/customer/main/product.tpl and change the line:

Code:
{if $active_modules.Product_Options ne ""}

to
Code:
{if $active_modules.Product_Options ne "" and $product.od eq "Y"}

Instead of modifying each product, you should use the import function to change the od field. Now products that don't have product options will cease to display the Options header.
Reply With Quote
  #5  
Old 05-01-2004, 10:25 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Haven't gotten a chance to test this mod, but I'm going to go ahead and move it over to the Custom mods and templates forum.

Thanks for sharing guys!
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #6  
Old 05-30-2004, 09:45 PM
 
nerd luv nerd luv is offline
 

Advanced Member
  
Join Date: Jun 2003
Location: California, USA
Posts: 58
 

Default

xcell67, that was most helpful. Only a few of my products have options, so this was perfect. Thank you very much!
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 04:13 AM.

   

 
X-Cart forums © 2001-2020