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");
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=