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

Auto populate featured products table

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 10-22-2010, 08:16 PM
  fmoses's Avatar 
fmoses fmoses is offline
Banned
 

Senior Member
  
Join Date: Apr 2008
Posts: 155
 

Default Re: Auto populate featured products table

Amazing, worked right off the bat, and makes life so much easier. Thanks so much for this contribution!
Reply With Quote
  #12  
Old 10-25-2010, 06:01 AM
  fmoses's Avatar 
fmoses fmoses is offline
Banned
 

Senior Member
  
Join Date: Apr 2008
Posts: 155
 

Default Re: Auto populate featured products table

Hi I was getting the error below, I noticed it by chance, as when I select the Add to All Categories button it just quickly flashes across the screen, and disappears almost instantaneously. It seems to be working though, just not sure what the error is though.

Warning: array_walk()[function.array-walk]: The argument should be an array in /home/anythin5/public_html/store/admin/categories.php on line 151.


I've included the a few of the lines above and below the error line that I'm getting.

HTML Code:
foreach ($new_temp_parent_cats as $a=>$z) { $temp_cats = func_query("SELECT categoryid FROM $sql_tbl[categories] WHERE parentid='$z'"); $new_temp_cats = array(); array_walk($temp_cats, 'flatten_array', &$new_temp_cats); $temp_products = func_query("SELECT $sql_tbl[products].productid FROM $sql_tbl[products] LEFT JOIN $sql_tbl[products_categories] ON $sql_tbl[products].productid = $sql_tbl[products_categories].productid WHERE $sql_tbl[products].forsale='Y' AND $sql_tbl[products_categories].categoryid IN ('$z','".implode("','", $new_temp_cats)."') AND $sql_tbl[products_categories].main = 'Y' ORDER BY RAND() LIMIT $pr_sub_cats"); $new_temp_products = array(); array_walk($temp_products, 'flatten_array', &$new_temp_products); $neworder = 0; foreach ($new_temp_products as $c=>$d) { db_query("INSERT INTO $sql_tbl[featured_products] (productid, product_order, avail, categoryid) VALUES ('$d','$neworder','$newavail', '$z')"); $neworder = $neworder + 10; } unset($temp_products); unset($new_temp_products); } }
Reply With Quote
  #13  
Old 03-18-2011, 09:42 AM
  Dan.roh's Avatar 
Dan.roh Dan.roh is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 397
 

Default Re: Auto populate featured products table

Thanks Steve, this is absolutely great!

I have changed my button in admin to read "Auto Populate" instead of "Add to all categories" - Makes more sense to me

If I want to add an extra button of some sort next to my "Auto Populate" button that controls this line below how would I go about it? I have changed mine to 8 instead of 4 but would like to be able to control this from my admin side

Code:
$pr_main_cat = 4; # products for front page (categoryid 0)


Any help would be greatly appreciated
__________________
Regards

Dan


Xcart version:
4.1.10 GOLD
Reply With Quote
  #14  
Old 03-18-2011, 09:53 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Auto populate featured products table

I have turned this into a mod but it's for 4.4.x. If you want me to work it out for you for another version email me with details.

http://www.cflsystems.com/public/everyone/auto_featured_products.png
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
Monika (10-15-2011)
  #15  
Old 05-19-2011, 12:18 PM
 
Makey2u Makey2u is offline
 

Member
  
Join Date: Dec 2010
Posts: 20
 

Default Re: Auto populate featured products table

hey, would you be able to post it for 4.4.3 or 4.4.x, i have this working but its not working for my sub categories for some reason...

love it tho big time kudos for you.
__________________
4.4.x
Testing store.
On windows
www.fashionwithin.com
Reply With Quote
  #16  
Old 05-20-2011, 04:41 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Auto populate featured products table

http://www.cflsystems.com/auto-populate-featured-products-for-x-cart-shopping-cart.html
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #17  
Old 05-20-2011, 02:44 PM
 
Makey2u Makey2u is offline
 

Member
  
Join Date: Dec 2010
Posts: 20
 

Default Re: Auto populate featured products table

Hey,
thanks allot i appreciate it.. i love it, at least it works on the front page,

but when it comes down to the sub catagories i dont know why but i cannot auto populate it, i have to manually add them... heres an error i get from SQL

SQL query : INSERT INTO xcart_featured_products (productid, categoryid, product_order, avail) VALUES ('532', '125','0','Y')
Error code : 1062
Description : Duplicate entry '532-125' for key 1
Request URI: /admin/categories.php
Backtrace:
/home/admin/example.com/xcart/include/func/func.db.php:291
/home/admin/example.com/xcart/include/func/func.db.php:191
/home/admin/example.com/xcart/admin/categories.php:215


i have a few of these errors every time i try to populate it, for some reason it says duplicate but its not.. or at least i dont see it because theres no items there....

are you familure with this??..

anyways even if you dont help me out i think you've done a remarkable job in all honesty, saves us all of time..

Mike
__________________
4.4.x
Testing store.
On windows
www.fashionwithin.com
Reply With Quote
  #18  
Old 05-20-2011, 02:49 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Auto populate featured products table

Where do you see this (version)? It used to do this yes, but I think it's fixed on 4.4.x (I think). The problem there is sometimes the script selects product that already exists as featured product for the category in question and that's not allowed
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #19  
Old 05-21-2011, 08:15 PM
 
Makey2u Makey2u is offline
 

Member
  
Join Date: Dec 2010
Posts: 20
 

Default Re: Auto populate featured products table

im on 4.4.3, its wierd i dont have anything seleceted at a featured item, but for catagories only it doesnt populate only for the front page, but empty catagories and it gives me those errors.. i dont get it.. its so werid.. i've tried stripping it down but im not getting anywhere.
__________________
4.4.x
Testing store.
On windows
www.fashionwithin.com
Reply With Quote
  #20  
Old 05-21-2011, 08:39 PM
 
Makey2u Makey2u is offline
 

Member
  
Join Date: Dec 2010
Posts: 20
 

Default Re: Auto populate featured products table

Ok so, i figured soething out, the layout of my page goes like this. Catagories>Catagories1 >Catagories 2> Items, So for example

Male > Company > Brand > items under brand

The catagories that get filled are the Front Page, and the Company and Brand Sections, but not the Male Section. its empty... which is wierd... the ffront page is fine too but when it goes to the 1st catagory, nothing, but after that its fine.. this is so wierd...
__________________
4.4.x
Testing store.
On windows
www.fashionwithin.com
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 02:49 AM.

   

 
X-Cart forums © 2001-2020