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

Adding "More Colors" to products_t.tpl listing

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-13-2012, 08:17 AM
  Ana's Avatar 
Ana Ana is offline
 

Senior Member
  
Join Date: Aug 2004
Location: Hurricane Alley, South Florida USA
Posts: 186
 

Lightbulb Adding "More Colors" to products_t.tpl listing

I've checked through this forum back to 1/2011 and I haven't seen anything addressing this (or I've missed it).

I'd like to add "More Colors" to the products_t.tpl listing if there is more than one color option for any given product so customers know while browsing that there are more colors available.

Has anybody done this or does anybody know of a module that will?

I've tried to code it myself but... epic fail.

Thanks in advance!

Ana
__________________
"Real knowledge is to know the extent of one's ignorance."-- Confucius

X-Cart 4.4.4
MySQL 5.0.92
Apache/2.0.64 (Unix)
PHP 5.3.6
CentOS 5.5

MODS:
Template Mela- Theme XCT010002
Altered Cart- CheckoutOne
BCS Engineering- Back In Stock Notification
X-Cart Mods- Thumbnail Candy
X-Cart Mods-Advanced Shop Closed
Google Site Search
Reply With Quote
  #2  
Old 01-14-2012, 08:47 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Adding "More Colors" to products_t.tpl listing

What you are talking about are referred to as "product options" and the way x-cart handles these are if the customer clicks the "add to cart" button in either "featured products" or the "category" page they will be re-directed to the "product" page where they can choose the option.

In order to allow the customer to choose the option(s) on the "featured products" or the "category" page the code from product_details.tpl would need to be added to featured.tpl, and products.tpl or products_t.tpl.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #3  
Old 01-14-2012, 02:19 PM
  Ana's Avatar 
Ana Ana is offline
 

Senior Member
  
Join Date: Aug 2004
Location: Hurricane Alley, South Florida USA
Posts: 186
 

Default Re: Adding "More Colors" to products_t.tpl listing

No, I want the words "More Colors" to appear on the product listing page so the customer knows the product is available in more colors while browsing the product list. So if the product has the product option of "Color" and there is more than one choice for that option, the words "More colors" appear on the products_t list with the product "as info".

I'm all too familiar with the options and variants of x-cart after working with it for 7 years. I think they are the reason for some of my silver hair. LOL

Ana
__________________
"Real knowledge is to know the extent of one's ignorance."-- Confucius

X-Cart 4.4.4
MySQL 5.0.92
Apache/2.0.64 (Unix)
PHP 5.3.6
CentOS 5.5

MODS:
Template Mela- Theme XCT010002
Altered Cart- CheckoutOne
BCS Engineering- Back In Stock Notification
X-Cart Mods- Thumbnail Candy
X-Cart Mods-Advanced Shop Closed
Google Site Search
Reply With Quote
  #4  
Old 01-17-2012, 06:40 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Adding "More Colors" to products_t.tpl listing

If "more colors" is the only product option you have (i.e. no "size", "length", etc.) then it should be a simple matter of checking if the product has options in your products_tpl and displaying a "more colors" text or text variable.

Something like adding..
{if $active_modules.Product_Options ne ""}"More Colors"{/if} to your products_t.tpl might work.

Otherwise, just follow how product options are displayed on the product.tpl and product_details.tpl to find where it is determined where a product has options or not and add that to your products_t.tpl in the appropriate place with the appropriate text.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #5  
Old 01-17-2012, 09:05 AM
  Ana's Avatar 
Ana Ana is offline
 

Senior Member
  
Join Date: Aug 2004
Location: Hurricane Alley, South Florida USA
Posts: 186
 

Default Re: Adding "More Colors" to products_t.tpl listing

Actually, we do have sizes as well but I see what you are getting at. All of our products have at least one color option so it would have to be any product who's color option values are greater than 1.

Basically if the product $v.class = color and it's classid.optionid value > 1 then display "more colors".

My problem is getting the coding correct. I'm not a wizbang at it

Ana
__________________
"Real knowledge is to know the extent of one's ignorance."-- Confucius

X-Cart 4.4.4
MySQL 5.0.92
Apache/2.0.64 (Unix)
PHP 5.3.6
CentOS 5.5

MODS:
Template Mela- Theme XCT010002
Altered Cart- CheckoutOne
BCS Engineering- Back In Stock Notification
X-Cart Mods- Thumbnail Candy
X-Cart Mods-Advanced Shop Closed
Google Site Search
Reply With Quote
  #6  
Old 01-17-2012, 01:20 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Adding "More Colors" to products_t.tpl listing

I don't think detailed option data is available on product listings pages. You need to customize the php to go get all of the option data for the products on that page. I believe there are other threads that have code to help get that data.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #7  
Old 01-18-2012, 05:56 AM
  Ana's Avatar 
Ana Ana is offline
 

Senior Member
  
Join Date: Aug 2004
Location: Hurricane Alley, South Florida USA
Posts: 186
 

Default Re: Adding "More Colors" to products_t.tpl listing

I'm not looking for detailed options on the product listing page. I just want the words "more colors" to appear on the product listing page beneath the image if the product has more than one color option available.

Ana
__________________
"Real knowledge is to know the extent of one's ignorance."-- Confucius

X-Cart 4.4.4
MySQL 5.0.92
Apache/2.0.64 (Unix)
PHP 5.3.6
CentOS 5.5

MODS:
Template Mela- Theme XCT010002
Altered Cart- CheckoutOne
BCS Engineering- Back In Stock Notification
X-Cart Mods- Thumbnail Candy
X-Cart Mods-Advanced Shop Closed
Google Site Search
Reply With Quote
  #8  
Old 01-18-2012, 06:48 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Adding "More Colors" to products_t.tpl listing

You still need to query the db, products options is not available on products list page. Try this

In include/search.php find
PHP Code:
// foreach ($products as $k => $v)
unset($thumb_dims); 

and just before add (replace 'Color' with your option class name exactly as you have it)

PHP Code:
// added by CFL Systems for 'more colors' note
$products[$k]['more_colors'] = func_query_first_cell("select count(*) from $sql_tbl[classes] where productid = $v[productid] and avail = 'Y' and class = 'Color'") > 'Y' 'N'

then in the products list template where you want it to show

Code:
{if $product.more_colors eq 'Y'} MORE COLORS NOTE {/if}
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
Ana (01-18-2012)
  #9  
Old 01-18-2012, 08:35 AM
  Ana's Avatar 
Ana Ana is offline
 

Senior Member
  
Join Date: Aug 2004
Location: Hurricane Alley, South Florida USA
Posts: 186
 

Default Re: Adding "More Colors" to products_t.tpl listing

Quote:
Originally Posted by cflsystems
You still need to query the db, products options is not available on products list page. Try this

In include/search.php find
PHP Code:
// foreach ($products as $k => $v)
unset($thumb_dims); 

and just before add (replace 'Color' with your option class name exactly as you have it)

PHP Code:
// added by CFL Systems for 'more colors' note
$products[$k]['more_colors'] = func_query_first_cell("select count(*) from $sql_tbl[classes] where productid = $v[productid] and avail = 'Y' and class = 'Color'") > 'Y' 'N'

then in the products list template where you want it to show

Code:
{if $product.more_colors eq 'Y'} MORE COLORS NOTE {/if}

You always seem to understand what I'm getting at, Steve! LOL! Thanks so much.

I had to do a little modification on it as all our products have at least one color so they will all have the class "Color", however, if there is more than one color the classtext is "Select Color" instead of "Color". Changed it to the classtext version and voila.

Steve, YOU ROCK!

Ana
__________________
"Real knowledge is to know the extent of one's ignorance."-- Confucius

X-Cart 4.4.4
MySQL 5.0.92
Apache/2.0.64 (Unix)
PHP 5.3.6
CentOS 5.5

MODS:
Template Mela- Theme XCT010002
Altered Cart- CheckoutOne
BCS Engineering- Back In Stock Notification
X-Cart Mods- Thumbnail Candy
X-Cart Mods-Advanced Shop Closed
Google Site Search
Reply With Quote
  #10  
Old 01-18-2012, 09:37 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Adding "More Colors" to products_t.tpl listing

No problem, glad you got it working
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 10:45 PM.

   

 
X-Cart forums © 2001-2020