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

Cron for Html Catalog Generation?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 08-18-2004, 01:44 AM
 
garryhs garryhs is offline
 

Senior Member
  
Join Date: Sep 2002
Location: Australia
Posts: 159
 

Default Cron Job to Run Catalog

Hi all,

Yes, if you are after a Cron Script to Produce your Catalog in either 3.4.x or 3.5.x then just email me at enquiries@x-cart-plus.com

Thanks for the positive feedback Adpboss.
__________________
All versions of X-Cart

Been in eCommerce 10 years, Coding, PM, SEO, Social. X-Cart 11 years. IT 30+ years.

Head of Web Dev for Australia's largest eCommerce 2 years.

Attended conferences, Velocity 2009 US, CeBit 2009, MySQL 2010 US, Online Retailer 2010, Web 2.0 2011 US, MySQL 2012 US (Percona).

Specialise in High Performance, High Volume, PHP, MySQL, HTML, CSS, JAVASCRIPT, SMARTY, MEMCACHED, APACHE, LIGHTTPD, FREEBSD, LINUX.

Email your requests to xcart@gazwebtech.com
Reply With Quote
  #12  
Old 10-09-2004, 03:34 PM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default

Just an update.
To setup cron job in v4 (and this will work in v35):

in html_catalog.php

Replaced:

Code:
require $xcart_dir."/include/security.php";

With:

Code:
if ($_SERVER[DOCUMENT_ROOT]) { # # Running from the web, make sure we authenticate the user # require $xcart_dir."/include/security.php"; } else { # # Running from command line # $command_line_mode = true; ini_set('html_errors', '0'); $REQUEST_METHOD = 'POST'; $start_category = ''; $mode = 'catalog_gen'; $namestyle = 'hyphen_4'; $process_subcats = 'checked'; $pages_per_pass = 0; $gen_action = 3; $process_staticpages = 'checked'; $lngcat[US] = '/..'; }

Cron job will be:

Code:
05 02 * * * cd /home/path_to_your_account/x-cart/admin; /usr/local/bin/php -q -f html_catalog.php
__________________
Best regards,

Anton Pachkine
X-cart.hosting
Reply With Quote
  #13  
Old 04-30-2005, 11:34 AM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default

Sorry to bring up an old post, but if you are running the cronjob from a none Command Line setup, how would you run this?

We run from a plesk server which is not a command line setup of php, so we cant run this as one.
We have tried running through Lynx like this:

Code:
/usr/local/bin/lynx -dump http://www.xxxxxx.com/admin/html_catalog.php

But we are then confronted with the error that Lynx does not have access to the file, as lynx is in effect only a browser itself.
Is there anyway we can add code to allow access to Lynx?
Or anyway to dump the command if not by command line?

Many thanks.
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote
  #14  
Old 04-30-2005, 11:51 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

I setup the cron job in cPanel and it does work when I just tested it on a line command, BUT, it generates the catalog at root level. The problem is that I need to generate it in the catalog as I have many stores in root level directories.

I have replaced the code as 27stars mentioned and the DIR CATALOG still is the same:

Code:
require $xcart_dir."/include/security.php"; } else { # # Running from command line # $command_line_mode = true; ini_set('html_errors', '0'); $REQUEST_METHOD = 'POST'; $start_category = ''; $mode = 'catalog_gen'; $namestyle = 'hyphen_4'; $process_subcats = 'checked'; $pages_per_pass = 0; $gen_action = 3; $process_staticpages = 'checked'; $lngcat[US] = '/..'; } $location[] = array(func_get_langvar_by_name("lbl_html_catalog"), ""); define ('DIR_CATALOG', '/catalog');
So, why would this generate in root vs. in my store/catalog as the DIR CATALOG location says?

Thanks for your assistance!

- Mike
__________________
4.1.9
Reply With Quote
  #15  
Old 06-04-2005, 07:22 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

OK, this problem was fixed by putting a bash script at server root (below public_html):
Create a file with the correct paths and call it html_catalog.sh
Code:
cd /home/your/path/to/admin /usr/local/bin/php -q -f html_catalog.php mv /home/user_account_here/public_html/*.html /home/user_account_here/public_html/dir_for_store/
Now you just need to create the cron job. In cPanel this is easy: Cron jobs/Advanced (UNIX Style)

Enter the time to run the job and the script: /bin/sh /home/user_account_here/html_catalog.sh

Now, html catalog is created automatically at whatever time you choose. The previous posts create the modification in the html_catalog.php and this just moves the files from root to the dir. of the store. If you want them in root, that's OK, just skip the bash script. - Mike
__________________
4.1.9
Reply With Quote
  #16  
Old 12-05-2005, 05:40 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

27stars last bit of code from Oct 9 2004 works for me up to a point (!) but my html_catalog.php won't recognise:

Code:
if ($_SERVER[DOCUMENT_ROOT]) {

..it's a blank if I debug so it goes straight to the catalog generation from the admin section i.e. command line mode. Any ideas why this might be?

Thanks

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #17  
Old 12-05-2005, 07:58 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

It's probably getting killed by X-Cart "security."

Instead try the less secure: $DOCUMENT_ROOT
Reply With Quote
  #18  
Old 04-23-2006, 12:57 PM
 
nfc5382 nfc5382 is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 472
 

Default

seems to work for a little bit, but eventually dies? even when I try to generate the catalog through the xcart admin the same happens....

% php -q -f html_catalog.php
Generating catalog

Converting pages to HTML
./catalog/index.html

./catalog/ATV-p-1-c-195.html

./catalog/ATV_Accessories-p-1-c-200.html

./catalog/ATV_Accessories-p-2-c-200.html

./catalog/Horn_Kit_ATV-p-16511.html

./catalog/ATV_Whip-p-16530.html

./catalog/Lighted_ATV_Whip-p-16531.html

./catalog/NGK_SPARK_PLUGS_BOX_OF_10-p-16744.html

./catalog/TIE_DOWNS_HEAVY_DUTY-p-17338.html

./catalog/Tire_Chains_REAR_EIGER___VINSON-p-17760.html

./catalog/ATV_Gun_Boot-p-17761.html

./catalog/GUN_BOOT_MOUNTING_BRACKET-p-17762.html

./catalog/ATV_QuadSport_Z400-p-1-c-210.html

Killed
__________________
-----------------------
x-cart v4.7.6 [LIVE]
x-cart v4.0.18 [retired 2004-2016]
x-cart v3.5.13 [retired]
x-cart v3.4.14 [retired]
Reply With Quote
  #19  
Old 04-26-2006, 07:37 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Moved to Custom Mods.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #20  
Old 08-18-2006, 01:55 PM
 
Skateboards.com Skateboards.com is offline
 

Advanced Member
  
Join Date: Jun 2006
Location: Santa Cruz, CA
Posts: 51
 

Default All this is good but..

Quote:
Originally Posted by mffowler
OK, this problem was fixed by putting a bash script at server root (below public_html):
Create a file with the correct paths and call it html_catalog.sh
Code:
cd /home/your/path/to/admin /usr/local/bin/php -q -f html_catalog.php mv /home/user_account_here/public_html/*.html /home/user_account_here/public_html/dir_for_store/
Now you just need to create the cron job. In cPanel this is easy: Cron jobs/Advanced (UNIX Style)

Enter the time to run the job and the script: /bin/sh /home/user_account_here/html_catalog.sh

Now, html catalog is created automatically at whatever time you choose. The previous posts create the modification in the html_catalog.php and this just moves the files from root to the dir. of the store. If you want them in root, that's OK, just skip the bash script. - Mike




I need my index.html to stay put in my docroot so my initial splash page will come up. I tried the code mentioned above and the generation works great but I really need a way to drop this automatically into my store/catalog dir....

My html_catalog.php reads like this:

Code:
# require $xcart_dir."/include/security.php"; ########################## # CATALOG SCHEDULER CODE ########################## if ($_SERVER[DOCUMENT_ROOT]) { # # Running from the web, make sure we authenticate the user # require $xcart_dir."/include/security.php"; } else { # # Running from command line # $command_line_mode = true; ini_set('html_errors', '0'); $REQUEST_METHOD = 'POST'; $start_category = ''; $mode = 'catalog_gen'; $namestyle = 'hyphen_4'; $process_subcats = 'checked'; $pages_per_pass = 0; $gen_action = 3; $process_staticpages = 'checked'; $lngcat[US] = '/..'; } $location[] = array(func_get_langvar_by_name("lbl_html_catalog"), ""); define ('DIR_CATALOG', '/catalog'); ##########################
__________________
Skateboards.com/Surfboards.com
------------------------------------------
X-Cart Pro 4.0.18
------------------------------------------
phpMyAdmin 2.6.4
------------------------------------------
MySQL 4.1.12
------------------------------------------
CentOS release 4.4
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


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 01:16 PM.

   

 
X-Cart forums © 2001-2020