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

Random Products - 2 Products Per Row - In Place of Featured

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #21  
Old 01-12-2003, 09:28 AM
 
Jonny Jonny is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 67
 

Default

Thanks m8

We are running on www.overclock.co.uk already but just havent implemented xcart as yet.

i am running here on a complete wireless Lan, it is amazing lol no wires.

we should be getting some NetGear stuff in soon aswell

Jonny.
Reply With Quote
  #22  
Old 01-16-2003, 11:42 PM
 
dfaa dfaa is offline
 

Member
  
Join Date: Sep 2002
Location: Norway
Posts: 14
 

Default Enter Your Price

Hi have installed these scripts among ther script and it all work great, but on The Enter your price,(under feature) i want to display the actual price , how can this bee done i have tried to modify the products.tpl and enter

<font class=TableCenterProductTitleOrange>{$lng.lbl_ente r_your_price}

to

<font class=TableCenterProductTitleOrange>{$products[product].price}

but it only displays 0.00

Can someone help me out here

http://data.eol.no
Reply With Quote
  #23  
Old 01-16-2003, 11:54 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Try this new and revised code for the randoms.php file. It now joins the product table with the pricing table - should have been in there really to start with..sorry everyone

Code:
removed cos it was wrong!!
__________________
ex x-cart guru
Reply With Quote
  #24  
Old 01-17-2003, 12:17 AM
 
dfaa dfaa is offline
 

Member
  
Join Date: Sep 2002
Location: Norway
Posts: 14
 

Default Error after new randoms.php

Hi there must be something wrong with the new code. ir runs an SQL eror.

INVALID SQL: 1052 : Column: 'productid' in where clause is ambiguous
SQL QUERY FAILURE: SELECT * FROM xcart_products,xcart_pricing WHERE forsale='Y' AND avail>0 AND xcart_products.productid=xcart_pricing.productid AND (productid='8' OR productid='47' OR productid='61' OR productid='54' OR productid='40' OR productid='34' OR productid='11' OR productid='42' OR productid='60' OR productid='57')
Reply With Quote
  #25  
Old 01-17-2003, 12:34 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

okay - sorry..amateur mistake

amend the code to:

Code:
<? // give it all available products to work with $products_id = func_query("SELECT productid FROM $sql_tbl[products] WHERE forsale='Y' and avail>0"); // set the variables $str = ""; $numberRandoms=10; // set this to how many you want to show // the witchcraft $query_condition = " AND ("; srand((double)microtime()*1000000); $rnd = rand(0, count($products_id)-1); $query_condition .= "$sql_tbl[products].productid='".$products_id[$rnd][productid]."'"; for($i = 0; $i < $numberRandoms - 1; $i++) { $rnd = rand(0, count($products_id)-1); if (!ereg("'".$products_id[$rnd][productid]."'", $query_condition)) { $query_condition .= " OR $sql_tbl[products].productid='".$products_id[$rnd][productid]."'"; } } // finish off the query $query_condition .= ")"; // runs the new random query against the database // $query = "SELECT * FROM $sql_tbl[products] WHERE forsale='Y' AND avail>0".$query_condition; $query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].productid=$sql_tbl[pricing].productid".$query_condition; // give the product array to smarty to make it available sitewide. $randoms = func_query($query); $smarty->assign("randoms",$randoms); ?>
__________________
ex x-cart guru
Reply With Quote
  #26  
Old 03-02-2003, 09:49 PM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

Funky, this code is great and your instructions are GREAT! I just read through the thread, followed the steps, used the revised random.php code and it works perfect.

But of course, I have a question.

Sometimes it shows 7, 8 or 9 products. I only have 50 products added so far, so I'm thinking that once I get all 300 or so added in that it will always show 10. If not, I really don't care, because just having it randomize is SO COOL!

Thanks,
Cameron
Reply With Quote
  #27  
Old 03-02-2003, 10:18 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Thanks.

It should be showing 10 products though.
__________________
ex x-cart guru
Reply With Quote
  #28  
Old 03-02-2003, 10:58 PM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

No worries. I realized that I like having 8 products there, anyway, so I changed the value to 8. Sometimes it shows 6 or 7, but I think it is actually cool so that people coming back see a pretty dynamic page. Google spiders will probalby love it, too.

Cameron
Reply With Quote
  #29  
Old 03-02-2003, 11:14 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

cant remember why I wrote this now , but very useful instead of featured products and to have a different looking front page every visit.
__________________
ex x-cart guru
Reply With Quote
  #30  
Old 03-03-2003, 07:05 PM
 
okdpminc okdpminc is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 74
 

Default

Funky, You wrote it because I asked if anybody had this feature, and you came in and knocked it out in no time. Mine also comes up one short on occasion, but it's no big deal at all. Thanks a MILLION for the great code!
__________________
- okdpm

X-Cart Gold Version: 3.5.1

Things are more like they are now than they have ever been before...
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:54 AM.

   

 
X-Cart forums © 2001-2020