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

get manufacture in products.php

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #41  
Old 07-04-2005, 07:07 AM
  BCSE's Avatar 
BCSE BCSE is offline
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default

Someone came to me unable to get this code to work on their site and I wasn't able to fix it either so I created another way to do this.

To show the manufacturer on a per product basis on products.php you can also do this instead:

In products.php before:
Code:
$smarty->assign("products",$products);

Insert:
Code:
if($products) { foreach($products as $key=> $product) $products[$key]["manufacturer"]= func_query_first_cell("select manufacturer from $sql_tbl[manufacturers] where manufacturerid=".$product["manufacturerid"]); }

In skin1/customer/main/products_t.tpl or skin1/customer/main/products.tpl insert the following where you want the manufacturer to show up
Code:
{$products[product].manufacturer}

Hope that helps those who are stuck! A bit less code and less files to edit.

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #42  
Old 07-10-2005, 11:00 AM
 
fearnothing fearnothing is offline
 

Senior Member
  
Join Date: Jun 2005
Location: North East England
Posts: 124
 

Default

Hi Carrie

Just followed this thread through, and the main suggestions definitely don't work for me either (incorrect manufacturers, links to wrong manufacturers etc.) but your mod does work ... but only in certain situations:

products.tpl works fine when called from home.php?cat=x but not when called from search.php?mode=search

Can't get the code to work at all in products_t.tpl

Any suggestions?

Also, what would be the code to turn the Manufacturer name into an url? The code posted earlier in the thread is obviously relating to the original functions.

On a general point, anyone know why Carrie's variation is needed for some projects and not others?

Many thanks, FN
__________________
www.smartchoicemusic.com
Smart Choice Music - Import CD and DVD Specialists
4.6.0
MySQL 5.5.34
PHP 5.4.24
Apache/2.2.26
Multiple homegrown and paid-for mods
Reply With Quote
  #43  
Old 07-10-2005, 07:26 PM
  BCSE's Avatar 
BCSE BCSE is offline
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default

FN,

I'm not surprised it doesn't work for search.php You would need to add similar code to search.php If I get a chance, I will look into it and post the code here.

Also, this does work for product_t.tpl as that's what I used it on when writing the code, however, if you're talking about in the featured products section, then php code may need to be added to featured_products.php file I'd have to look at the code flow to be sure, but I believe that is the case.

Hope this helps some and if I get a chance I'll look into your questions more and post findings.

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #44  
Old 07-11-2005, 09:53 AM
 
fearnothing fearnothing is offline
 

Senior Member
  
Join Date: Jun 2005
Location: North East England
Posts: 124
 

Default

Thanks for that Carrie - This facility on Search results would make a big difference to my project.

Regarding product_t.tpl my only dealing with this so far is in Featured Products - I don't know what other features use this template??

I dug around in the forum after you said this, and this thread has provided the code for Manufacturer to appear in Featured Products:

http://forum.x-cart.com/viewtopic.php?t=19684

I'll take a look now and see if I can use it in Search Results

This subject seems to be turning up in lots of guises in different parts of the forum - It might be useful if someone with more knowledge than I have rounds up all of this useful information at some stage??
__________________
www.smartchoicemusic.com
Smart Choice Music - Import CD and DVD Specialists
4.6.0
MySQL 5.5.34
PHP 5.4.24
Apache/2.2.26
Multiple homegrown and paid-for mods
Reply With Quote
  #45  
Old 07-11-2005, 10:08 AM
 
fearnothing fearnothing is offline
 

Senior Member
  
Join Date: Jun 2005
Location: North East England
Posts: 124
 

Default

It looks like a combination of code snippets from Carrie's solution, the main solution in this thread and the one in the thread I referred to in my last post has done the trick.

It seems as though the php code in http://forum.x-cart.com/viewtopic.php?t=19684 has generated the correct results for the template changes suggested by Carrie.

I now have Manufacturers appearing in products.tpl and product_t.tpl whether viewing by categories or by seach results, and also in Featured Products. The code to have Manufacturers appear in product.tpl as suggested in this post also works a treat.

Good news all round - sincere thanks to all the forumistas who have contributed to this one!!

FN
__________________
www.smartchoicemusic.com
Smart Choice Music - Import CD and DVD Specialists
4.6.0
MySQL 5.5.34
PHP 5.4.24
Apache/2.2.26
Multiple homegrown and paid-for mods
Reply With Quote
  #46  
Old 07-12-2005, 06:56 AM
  BCSE's Avatar 
BCSE BCSE is offline
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default

Glad you got it figured out.

products_t.tpl can be used on the normal products.php pages if you have in the admin set for products to be showin in multi column format.

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #47  
Old 07-12-2005, 12:14 PM
 
fearnothing fearnothing is offline
 

Senior Member
  
Join Date: Jun 2005
Location: North East England
Posts: 124
 

Default

A-ha ... so that's where that template shows up. Useful information and something to bear in mind when I'm tinkering with it.

Much appreciated! FN.
__________________
www.smartchoicemusic.com
Smart Choice Music - Import CD and DVD Specialists
4.6.0
MySQL 5.5.34
PHP 5.4.24
Apache/2.2.26
Multiple homegrown and paid-for mods
Reply With Quote
  #48  
Old 07-20-2005, 12:55 PM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

Default

This also works like a charm for the search (thanks everyone who's posted) - this is an extension of Carrie's solution

in include/search.php

just before:

Code:
$smarty->assign("products",$products);

include:

Code:
if($products) { foreach($products as $key=> $product) $products[$key]["manufacturer"]= func_query_first_cell("select manufacturer from $sql_tbl[manufacturers] where manufacturerid=".$product["manufacturerid"]); }

To get the manufacturer's name to hyperlink, simply use:

Code:
<a href="manufacturers.php/?manufacturerid={$products[product].manufacturerid}">{$products[product].manufacturer}</a>

instead of:

Code:
{$products[product].manufacturer}

where you would like it to show up in skin1/customer/main/products_t.tpl or skin1/customer/main/products.tpl
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #49  
Old 12-10-2006, 01:01 PM
 
gastu gastu is offline
 

Senior Member
  
Join Date: Oct 2005
Location: Chile
Posts: 105
 

Default Re: get manufacture in products.php

Quote:
Originally Posted by BCSE
Someone came to me unable to get this code to work on their site and I wasn't able to fix it either so I created another way to do this.

To show the manufacturer on a per product basis on products.php you can also do this instead:

In products.php before:
Code:
$smarty->assign("products",$products);

Insert:
Code:
if($products) { foreach($products as $key=> $product) $products[$key]["manufacturer"]= func_query_first_cell("select manufacturer from $sql_tbl[manufacturers] where manufacturerid=".$product["manufacturerid"]); }

In skin1/customer/main/products_t.tpl or skin1/customer/main/products.tpl insert the following where you want the manufacturer to show up
Code:
{$products[product].manufacturer}

Hope that helps those who are stuck! A bit less code and less files to edit.

Carrie

no work in 4.1.x
how can fix?
__________________
Gonzalo Astudillo Pizarro | https://about.me/gonzaloastudillo
Reply With Quote
  #50  
Old 12-27-2006, 07:28 AM
 
rbester rbester is offline
 

Newbie
  
Join Date: Aug 2006
Posts: 3
 

Default Re: get manufacture in products.php

It did work for us. Thanks!

Also, added the code in featured_products.php (same as in products.php) - so it works on the featured products list as well.
__________________
R. Bester
X-Cart in Hebrew
http://www.newtech-ayalon.com/ (ver. 4.1.3)
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 10:51 AM.

   

 
X-Cart forums © 2001-2020