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

Generate Product HTML on Modify [3.5.x]

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 08-20-2004, 11:33 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

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

Default Generate Product HTML on Modify [3.5.x]

Here's a mod I did on cart-lab.com, I was sick of re-updating the product html every time I made a change to my products. It works in a sense that it will update the product's html counter part, however all subsequent pages, like index.html and related product(s), etc. Wont be generated, so you end up having to regenerate the html catalog again. If anyone wants to take it a step further into 4.0.x perhaps and add the missing features to make it complete feel free.

admin/html_catalog.php after:
Code:
func_html_location("html_catalog.php",30);
add the following:
Code:
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Generate HTML after file modify/add product mod by cart-lab.com # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= } elseif($REQUEST_METHOD=="GET" && $mode=="gen") { # no name style defined use underscore by default $namestyle = $namestyle ? true : "hyphen"; # stripped down version of original my_save_data function function save_data_nooutput($filename, $data) { global $hc_state, $count; $fp = fopen($filename, "w+"); if (!$fp) { echo "<font color=red>Cannot save file: ".$filename."</font>"; x_session_save(); exit; } fwrite($fp, $data); $count++; } # naming convientions if ($namestyle == "hyphen") { $hc_state["product_namestyle"] = "{product_name}-p-{productid}.html"; } elseif ($namestyle == "new") { $hc_state["product_namestyle"] = "{product_name}_p_{productid}.html"; } else { $hc_state["product_namestyle"] = "product_{productid}_{product_name}.html"; } if($productid) { #list($http_headers, $page_src) = func_http_get_request($site_location["host"].":".$site_location["port"], $site_location["path"].DIR_CUSTOMER."/home.php", ""); #$page_src = process_page($page_src); #save_data_nooutput("$cat_dir/index.html", $page_src); $product_data = func_query("SELECT product, productid, categoryid, categoryid1, categoryid2, categoryid3 FROM $sql_tbl[products] WHERE productid=$productid"); list($http_headers, $page_src) = func_http_get_request($site_location["host"].":".$site_location["port"], $site_location["path"].DIR_CUSTOMER."/product.php", "productid=$productid"); $page_src = process_page($page_src); $page_name = product_filename($product_data[0]["productid"], $product_data[0]["product"]); save_data_nooutput("$cat_dir/$page_name", $page_src); $smarty->assign("main","product_modify_message"); @include $xcart_dir."/modules/gold_display.php"; $smarty->display("admin/home.tpl"); } # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Next edit include/product_modify.php and find the code segment:
Code:
} else { # # Form filled with errors #

Paste the following above it

Code:
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Generate HTML after file modify/add product mod by cart-lab.com # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= func_header_location("..".DIR_ADMIN."/html_catalog.php?mode=gen&productid=$productid"); # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #2  
Old 08-21-2004, 12:12 AM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default

This is Excellent Mod. This way I won't have to generate whole 1500 product catalgo just for one single product modification!

Will this work in 3.4.0
thanks
__________________
X-Cart Version 4.1.8
Hosted on Linux
Reply With Quote
  #3  
Old 08-21-2004, 08:59 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

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

Default

It *MAY* work in 3.4.x all you should need to change is the "..".DIR_ADMIN."/html_catalog.php to "../admin/html_catalog.php
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #4  
Old 08-24-2004, 12:06 PM
 
POSDepot POSDepot is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 52
 

Default

I get this error after saving a product:

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home2/softsell/pointofsaledepot-www/store/include/func.php on line 2801

Warning: fsockopen(): unable to connect to www.pointofsaledepot.com::80 in /home2/softsell/pointofsaledepot-www/store/include/func.php on line 2801

It then creates a 0 byte html file.

Any ideas?

Thanks
Randy
__________________
X-Cart Gold
4.1.9
Reply With Quote
  #5  
Old 08-24-2004, 01:45 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

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

Default

Generating the HTML cat regularly generate any errors?
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #6  
Old 08-24-2004, 02:15 PM
 
POSDepot POSDepot is offline
 

Advanced Member
  
Join Date: Sep 2002
Posts: 52
 

Default

nope .. just after I edit a product.
__________________
X-Cart Gold
4.1.9
Reply With Quote
  #7  
Old 08-28-2004, 11:31 PM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default

I tried in and after modifying when I clicked submit button, on next page header it gave following error. And html catalog part for that product page stayed blank.


Quote:
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/mysite/public_html/films/include/func.php on line 2221

Warning: fsockopen(): unable to connect to www.mysite.com::80 in /home/mysite/public_html/films/include/func.php on line 2221
__________________
X-Cart Version 4.1.8
Hosted on Linux
Reply With Quote
  #8  
Old 07-11-2005, 02:21 PM
 
isi isi is offline
 

Newbie
  
Join Date: Sep 2004
Posts: 4
 

Default

Did anyone get this working in 4.x? Seems like a great time saving mod.

----
ISI
X-Cart 4.0.13
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 04:15 PM.

   

 
X-Cart forums © 2001-2020