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

Coding With Product's Extra Fields

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 09-15-2004, 07:14 PM
 
willirl willirl is offline
 

eXpert
  
Join Date: Mar 2004
Location: OHIO
Posts: 271
 

Default

I don't think that will work on the products.tpl page. I think you will have to do some SQL there to get the $extra_fields from the database for the "current product".
__________________
Richard

x-cart version 4.0.17
http://roguewavemarine.com
Reply With Quote
  #12  
Old 09-15-2004, 07:21 PM
 
mizzlewillz mizzlewillz is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 45
 

Default

I don't know SQL that well or I would create a statement. I'll give it a try but I don't think I will be able to do much.

-Mike
Reply With Quote
  #13  
Old 09-15-2004, 07:27 PM
 
Emerson Emerson is offline
 

X-Man
  
Join Date: Mar 2004
Location: Atlanta, GA
Posts: 2,209
 

Default

Quote:
Originally Posted by willirl
I don't think that will work on the products.tpl page. I think you will have to do some SQL there to get the $extra_fields from the database for the "current product".

You are right, this would work on the product.tpl, not the products.tpl file
__________________
Emerson
Total Server Solutions LLC- Quality X-Cart Hosting
Recommended X-Cart Hosting Provider - US and UK servers
Does your host backup your site? We do EVERY HOUR!!!
Shared Hosting | Managed Cloud | Dedicated Servers
Reply With Quote
  #14  
Old 02-26-2006, 10:38 AM
 
btomasie btomasie is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 80
 

Default

Bringing this back to life... has anyone tackled this for the products.tpl page? I am trying to use an Extra Field as a way to group all my products into unofficial subcategories all on one page.

Thanks much,
Brian
__________________
X-Cart Gold v4.0.18 [unix]
- Easy Checkout module
- ezUpsell module
- CDSEO module

X-Cart Gold v4.1.11 [unix]
***38,000+ active products!
- CDSEO module
- Address Book module
- Reorder module
- Smart Search module

X-Cart Gold v4.4.2 [unix]
- in development now!
Reply With Quote
  #15  
Old 03-04-2006, 04:29 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default

So why would this work on product.tpl and not products.tpl?
Code:
{if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} {/if}

Do I need to call the individual extra fields explicitly? I want to display the extra fields on the home page in featured listings, as well as on the category displays.

Thanks.
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #16  
Old 03-07-2006, 08:47 AM
 
dashonice dashonice is offline
 

Member
  
Join Date: May 2005
Posts: 23
 

Default

It works on product.tpl because product.php gets the extra fields info from the database. Unfortunately products.php does not do this so the variable is not availble to products.tpl.
__________________
Version 4.0.18
Testing 4.1.2
Reply With Quote
  #17  
Old 03-07-2006, 07:36 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default

Ok.

Does anyone know if this is "does not" or "can not" though?

Can the calls that pull the info into product.tpl be called into productS.tpl? Is there a reason why it isn't or couldn't be?

Should this be a thread for the "program logic" area?

Thanks, dash.
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #18  
Old 03-08-2006, 05:50 AM
 
willirl willirl is offline
 

eXpert
  
Join Date: Mar 2004
Location: OHIO
Posts: 271
 

Default

Here is the code that I used to get to the extra fields in products.tpl. This code must go inside the product loop. I put it immediately after this code:


Add this code:

Code:
{* Get the product ID as we loop through the products to be displayed *} {assign var="productId" value=$products[product].productid} {php} global $sql_tbl; // Get the product id from the smarty var $productid=$this->get_template_vars('productId'); // Get the rows from the extra_field_values table for this product id if($productid) { $extra_fields = func_query( "SELECT productid, fieldid, value as field_value FROM $sql_tbl[extra_field_values] WHERE productid = $productid" ); } $this->assign("extra_fields",$extra_fields); {/php}

The extra fields are referenced in your code using $extra_fields[<field number>] like this:

Code:
{$extra_fields[2].field_value}

Have fun.
__________________
Richard

x-cart version 4.0.17
http://roguewavemarine.com
Reply With Quote

The following user thanks willirl for this useful post:
successco (05-15-2010)
  #19  
Old 03-08-2006, 07:00 PM
 
Total Hosting Total Hosting is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default

Thanks Willirl.

Do you have a working example? I put your code in the same spot as you indicated, however I am not able to get the extra fields to display.

I tried calling via
Code:
{if $active_modules.Extra_Fields ne ""} {include file="modules/Extra_Fields/product.tpl"} {/if}
which is how I am calling them into the product.tpl, as well as directly with
Code:
{$extra_fields[2].field_value}

Is there any way to see what field numbers are in use? I don't see that info in the admin view.

Thanks for the help.
__________________
Regards,

Peter Stoermer
http://www.TotalHosting.com for http://www.EmpowermentGroup.com
X-cart: 4.0.17
Reply With Quote
  #20  
Old 03-09-2006, 05:46 AM
 
willirl willirl is offline
 

eXpert
  
Join Date: Mar 2004
Location: OHIO
Posts: 271
 

Default

Oops. I forgot about products_t.tpl. Add the same code following these lines:

Code:
{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"} {section name=product loop=$products} {assign var="discount" value=0}

The fields are assigned (I think) in the order you specify them in your upload or on your product edit page. The first one is [1] etc..
__________________
Richard

x-cart version 4.0.17
http://roguewavemarine.com
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 02:30 PM.

   

 
X-Cart forums © 2001-2020