X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Notify me when the product's information, price and stock level is changed (https://forum.x-cart.com/showthread.php?t=26853)

ShishaPipeUK 11-23-2006 01:52 PM

Notify me when the product's information, price and stock level is changed
 
Notify me when the product's information, price and stock level is changed

You can see this in action at http://www.theshisha.com/shopcart/product.php?productid=16139&cat=0&page=1

This modification is for x-cart 4.1.3 version
I have posted this modification so that x-cart forum members can contribute to the code and hopefully make any improvements to the modification and post them in this thread.

Now about the modification:

CUSTOMER:

1. When customer is on "Product Details" page, s/he will see a new form:
------
Notify my when the product's information is changed: < "Enter the email here..." text field >
<"Submit" button>
------

The form will look similar for both logged and not logged customer. The only exception will be that the email from the user' profile will be pre-filled in the text-field, however, can be changed to another address, if needed.

2. After clicking "Submit", the script will create a special record in the database, containing the productID, current description, price, quantity in stock and specified email address (a new table will be created for this purpose).

ADMIN:

When changing the product details (submitting "Product Modify" form, or using "Products import" facility), the script will look if there are any email addresses, associated with the current productID.

If yes, it will look for the differences in one of the following fields:
- Short/Long description;
- Price;
- Quantity in stock (from 0 to a bigger value).

I.e., it will compare the date, was stored when customer submitted a new form and the currently submitted by the admin data.

If any of described changes have taken place, a special "Product information has changed" email will be sent to all the email addresses, associated with current product.

The email will contain the text, saying that the information about the product has changed (language variable, which the admin can change in "Languages" section) and the link to "Product Details" page. updated product's information.

Also, the information, saved about the product initially (in new table) will be updated with the new product's information (will allow to catch the next changes for the product).

Also with the email your customer receives, you have the option to unsubscribe to the product notify me.

This modification requires five original xcart 4.1.3 files to be changed:
init.php
product.php
include/import_products.php
include/product_modify.php
skin1/customer/main/product.tpl

Four new x-cart files
changed_product_notify.php
skin1/mail/productinfo_has_changed.tpl
skin1/mail/productinfo_has_changed_subj.tpl
skin1/mail/html/productinfo_has_changed.tpl

And a change to the SQL file which is below.

Apply the SQL changes (Open the Patch/Upgrade page in admin area and select the patch.sql from the archive for the "Apply SQL patch" section).

Code:


UPDATE xcart_config SET value='1164025634' WHERE name='data_cache_expiration';
UPDATE xcart_config SET value='19' WHERE name='survey_sending_remainder';
CREATE TABLE xcart_email_for_changed_products (productid int(11) NOT NULL default '0',email varchar(128) NOT NULL default '',descr text NOT NULL default '',fulldescr text NOT NULL default '',price decimal(12,2) NOT NULL default '0.00',avail int(11) NOT NULL default '0',PRIMARY KEY (productid,email)) TYPE=MyISAM;
INSERT INTO xcart_languages SET code='US', name='eml_productinfo_has_changed', value='The product description, price, or quantity has changed with regard to this product.<br><br>Please go to the product for more details.', topic='E-Mail';
INSERT INTO xcart_languages SET code='US', name='eml_productinfo_has_changed_subj', value='Product information has changed', topic='E-Mail';
INSERT INTO xcart_languages SET code='US', name='lbl_notify_about_changed_product', value='Notify me when the product's information is changed', topic='Labels';
INSERT INTO xcart_languages SET code='US', name='lbl_notify_me', value='Notify me if any changes are made to the above product', topic='Labels';
INSERT INTO xcart_languages SET code='US', name='productinfo_has_changed_subj', value='Product information has changed', topic='Labels';
INSERT INTO xcart_languages SET code='US', name='txt_unsubscribe_message', value='You have unsubscribed to the email notification about product changes.', topic='Text';


Upload the Four new x-cart files

changed_product_notify.php - This new file goes in the root of your x-cart, same area as where the home.php file is.

Code:


<?php
if($mode == "unsubscribe"){
 require "./auth.php" ;
 db_query("DELETE FROM $sql_tbl[email_for_changed_products] WHERE productid='$productid' AND email='$email'");
 echo($message);
 exit;
}
if ($mode == "changed_product_notify" && !empty($notify_email)){
 $is_notified = func_query_first("SELECT productid FROM $sql_tbl[email_for_changed_products] WHERE productid='$productid' AND email='$notify_email'");
 if ($is_notified)
  db_query("DELETE FROM $sql_tbl[email_for_changed_products] WHERE productid='$productid' AND email='$notify_email'");
 
 db_query("INSERT INTO $sql_tbl[email_for_changed_products] VALUES ('$productid', '$notify_email', '$desc', '$fulldesc', '$price', '$avail')");
}
if ($login) {
 $notify_email = func_query_first_cell("SELECT email FROM $sql_tbl[customers] WHERE login='$login'");
 $smarty->assign("notify_email", $notify_email);
}
?>


skin1/mail/productinfo_has_changed.tpl

Code:


{* $Id: productinfo_has_changed.tpl,v 1.0 2006/11/23 Shishapipe UK $ *}
{config_load file="$skin_config"}
{include file="mail/mail_header.tpl"}
{$lng.eml_productinfo_has_changed}
{include file="mail/signature.tpl"}


skin1/mail/productinfo_has_changed_subj.tpl

Code:

{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.eml_productinfo_has_changed_subj}

skin1/mail/html/productinfo_has_changed.tpl

Code:


{* $Id: productinfo_has_changed.tpl,v 1.0 2006/11/23 Shishapipe UK *}
{config_load file="$skin_config"}
{include file="mail/html/mail_header.tpl"}
<P>{$lng.eml_productinfo_has_changed}
<P>{$lng.product_details}
<P><A href="{$http_location}/product.php?productid={$productid}" target=_new>{$http_location}/product.php?productid={$productid}</A>
<P><A href="{$http_location}/changed_product_notify.php?mode=unsubscribe&email={$email}&productid={$productid}&message={$lng.txt_unsubscribe_message}" target=_new>Click HERE to Unsubscribe from this product change notify me</A>
{include file="mail/html/signature.tpl"}


ShishaPipeUK 11-23-2006 01:54 PM

Re: Notify me when the product's information, price and stock level is changed
 
Now to the five original xcart 4.1.3 files to be changed:

include/import_products.php

Look for this code:

Code:

  # Direct import
  $is_new = ($_productid === false);
  if (!empty($data)) {
  $data = func_addslashes($data);
  if ($_productid === false) {
    $data['provider'] = $import_data_provider;
    $_productid = func_array2insert("products", $data);
  } else {
    func_array2update("products", $data, "productid = '$_productid'");
  }
  }


replace it with:

Code:


# Direct import
  $is_new = ($_productid === false);
  if (!empty($data)) {
  $data = func_addslashes($data);
  if ($_productid === false) {
    $data['provider'] = $import_data_provider;
    $_productid = func_array2insert("products", $data);
  } else {
# START: SHISHAPIPE UK MOD - theshisha.com
 
    # Check email for changed product
    $notify_emails = func_query("SELECT email FROM $sql_tbl[email_for_changed_products] WHERE productid='$_productid'");
    if ($notify_emails){
    foreach($notify_emails as $v){
      $old_product_data = func_query_first("SELECT * FROM $sql_tbl[email_for_changed_products] WHERE productid='$_productid' AND email='$v[email]'");
      if ($old_product_data["descr"] != $query_data["descr"] || $old_product_data["fulldescr"] != $query_data["fulldescr"] || $old_product_data["avail"] != $query_data["avail"]){
      global $mail_smarty;
      $mail_smarty->assign("productid", $_productid);
                      $mail_smarty->assign("email", $v["email"]);
                      func_send_mail($v["email"], "mail/productinfo_has_changed_subj.tpl", "mail/productinfo_has_changed.tpl", $config["Company"]["orders_department"], false);
      db_query("UPDATE $sql_tbl[email_for_changed_products] SET descr='".addslashes($data["descr"])."', fulldescr='".addslashes($data["fulldescr"])."', avail='$data[avail]' WHERE productid='$_productid' AND email='$v[email]'");
      }
    }
    }
    # /Check email for changed product
# END: SHISHAPIPE UK MOD - theshisha.com
    func_array2update("products", $data, "productid = '$_productid'");
  }
  }


Then look for this code in the same file include/import_products.php :

Code:

  # Import price
  if (isset($product['price']) || $is_new) {
  $product['price'] = doubleval($product['price']);
  $priceid = func_query_first_cell("SELECT priceid FROM $sql_tbl[pricing] WHERE productid = '$_productid' AND quantity = 1 AND membershipid = 0 AND variantid = 0");
  if ($priceid) {
    func_array2update("pricing", array("price" => $product['price']), "priceid = '$priceid'");


And replace it with:

Code:


  # Import price
  if (isset($product['price']) || $is_new) {
  $product['price'] = doubleval($product['price']);
  $priceid = func_query_first_cell("SELECT priceid FROM $sql_tbl[pricing] WHERE productid = '$_productid' AND quantity = 1 AND membershipid = 0 AND variantid = 0");
  if ($priceid) {
# START: SHISHAPIPE UK MOD - theshisha.com
    # Check email for changed product
    $notify_emails = func_query("SELECT email FROM $sql_tbl[email_for_changed_products] WHERE productid='$_productid'");
    if ($notify_emails){
    foreach($notify_emails as $v){
      $old_product_price = func_query_first_cell("SELECT price FROM $sql_tbl[email_for_changed_products] WHERE productid='$_productid' AND email='$v[email]'");
      if ($old_product_price != $product['price']){
      global $mail_smarty;
      $mail_smarty->assign("productid", $_productid);
      $mail_smarty->assign("email", $v["email"]);
      func_send_mail($v["email"], "mail/productinfo_has_changed_subj.tpl", "mail/productinfo_has_changed.tpl", $config["Company"]["orders_department"], false);
      db_query("UPDATE $sql_tbl[email_for_changed_products] SET price='$product[price]' WHERE productid='$_productid' AND email='$v[email]'");
      }
    }
    }
 
    # /Check email for changed product
# END: SHISHAPIPE UK MOD - theshisha.com
    func_array2update("pricing", array("price" => $product['price']), "priceid = '$priceid'");


ShishaPipeUK 11-23-2006 02:10 PM

Re: Notify me when the product's information, price and stock level is changed
 
include/product_modify.php

Find this code:

Code:


  # Update the default price
  if (!$is_variant)
    func_array2update("pricing", array("price" => $price), "productid='$productid' AND quantity='1' AND membershipid = 0 AND variantid = 0");
  if ($fields['price'] == 'Y' && $geid && !$is_variant) {
    while ($pid = func_ge_each($geid, 1, $productid)) {
    $is_variant_sub = (func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[variants] WHERE productid = '$pid'") > 0);
    if (!$is_variant_sub)
      func_array2update("pricing", array("price" => $price), "productid='$pid' AND quantity='1' AND membershipid = 0 AND variantid = 0");
    }
  }


and replace it with:

Code:


# Update the default price
  if (!$is_variant)
    func_array2update("pricing", array("price" => $price), "productid='$productid' AND quantity='1' AND membershipid = 0 AND variantid = 0");
  if ($fields['price'] == 'Y' && $geid && !$is_variant) {
    while ($pid = func_ge_each($geid, 1, $productid)) {
    $is_variant_sub = (func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[variants] WHERE productid = '$pid'") > 0);
    if (!$is_variant_sub)
      func_array2update("pricing", array("price" => $price), "productid='$pid' AND quantity='1' AND membershipid = 0 AND variantid = 0");
# START: SHISHAPIPE UK MOD - theshisha.com
    $notify_emails = func_query("SELECT email FROM $sql_tbl[email_for_changed_products] WHERE productid='$pid'");
    if ($notify_emails){
      foreach($notify_emails as $v){
      global $mail_smarty;
      $mail_smarty->assign("productid", $pid);
      $mail_smarty->assign("email", $v["email"]);
      func_send_mail($v["email"], "mail/productinfo_has_changed_subj.tpl", "mail/productinfo_has_changed.tpl", $config["Company"]["orders_department"], false);
      db_query("UPDATE $sql_tbl[email_for_changed_products] SET price='".abs($price)."' WHERE productid='$pid' AND email='$v[email]'");
      }
    }
# END: SHISHAPIPE UK MOD - theshisha.com
    }
  }


In the same file include/product_modify.php look for:

Code:


# Update taxes
db_query("DELETE FROM $sql_tbl[product_taxes] WHERE productid='$productid'");
if($geid && $fields['taxes']) {
while ($pid = func_ge_each($geid, 100, $productid)) {
db_query("DELETE FROM $sql_tbl[product_taxes] WHERE productid IN ('".implode("','", $pid)."')");
}
}
if (!empty($taxes) && is_array($taxes)) {
foreach ($taxes as $k=>$v) {
if (intval($v) > 0) {
$query_data = array(
"productid" => $productid,
"taxid" => intval($v)
);
func_array2insert("product_taxes", $query_data, true);
if($geid && $fields['taxes']) {
while ($pid = func_ge_each($geid, 1, $productid)) {
$query_data['productid'] = $pid;
func_array2insert("product_taxes", $query_data, true);
}
}
}
}
}


and replace it with:

Code:


# Update taxes
db_query("DELETE FROM $sql_tbl[product_taxes] WHERE productid='$productid'");
if($geid && $fields['taxes']) {
while ($pid = func_ge_each($geid, 100, $productid)) {
db_query("DELETE FROM $sql_tbl[product_taxes] WHERE productid IN ('".implode("','", $pid)."')");
}
}
 
# START: SHISHAPIPE UK MOD - theshisha.com 
# Check email for changed product
$notify_emails = func_query("SELECT email FROM $sql_tbl[email_for_changed_products] WHERE productid='$productid'");
if ($notify_emails){
foreach($notify_emails as $v){
$old_product_data = func_query_first("SELECT * FROM $sql_tbl[email_for_changed_products] WHERE productid='$productid' AND email='$v[email]'");
if ($old_product_data["descr"] != $query_data["descr"] || $old_product_data["fulldescr"] != $query_data["fulldescr"] || $old_product_data["price"] != abs($price) || $old_product_data["avail"] != $query_data["avail"]){
 
global $mail_smarty;
$mail_smarty->assign("productid", $productid);
$mail_smarty->assign("email", $v["email"]);
func_send_mail($v["email"], "mail/productinfo_has_changed_subj.tpl", "mail/productinfo_has_changed.tpl", $config["Company"]["orders_department"], false);
db_query("UPDATE $sql_tbl[email_for_changed_products] SET descr='".addslashes($query_data["descr"])."', fulldescr='".addslashes($query_data["fulldescr"])."', avail='$query_data[avail]', price='".abs($price)."' WHERE productid='$productid' AND email='$v[email]'");
}
}
}
 
# END: SHISHAPIPE UK MOD - theshisha.com 
if (!empty($taxes) && is_array($taxes)) {
foreach ($taxes as $k=>$v) {
if (intval($v) > 0) {
$query_data = array(
"productid" => $productid,
"taxid" => intval($v)
);
func_array2insert("product_taxes", $query_data, true);
if($geid && $fields['taxes']) {
while ($pid = func_ge_each($geid, 1, $productid)) {
$query_data['productid'] = $pid;
func_array2insert("product_taxes", $query_data, true);
}
}
}
}
}


In the same file include/product_modify.php look for:

Code:


FROM $sql_tbl[variants] WHERE productid = '$pid'") > 0);
      if ($is_variant_sub) {
      func_unset($query_data_sub, "avail", "weight");
      }
      func_array2update("products", $query_data_sub, "productid = '$pid'");
    } else {
      func_array2update("products", $query_data, "productid IN ('".implode("','", $pid)."')");
    }
    }
  }
  }


and replace it with:

Code:


FROM $sql_tbl[variants] WHERE productid = '$pid'") > 0);
      if ($is_variant_sub) {
      func_unset($query_data_sub, "avail", "weight");
      }
      func_array2update("products", $query_data_sub, "productid = '$pid'");
    } else {
      func_array2update("products", $query_data, "productid IN ('".implode("','", $pid)."')");
    }
# START: SHISHAPIPE UK MOD - theshisha.com 
 
    $notify_emails = func_query("SELECT email FROM $sql_tbl[email_for_changed_products] WHERE productid='$pid'");
    if ($notify_emails){
      foreach($notify_emails as $v){
      $old_product_data = func_query_first("SELECT * FROM $sql_tbl[email_for_changed_products] WHERE productid='$pid' AND email='$v[email]'");
      if ($old_product_data["descr"] != $query_data_sub["descr"] || $old_product_data["fulldescr"] != $query_data_sub["fulldescr"] || $old_product_data["avail"] != $query_data_sub["avail"]){
 
      global $mail_smarty;
      $mail_smarty->assign("prodictid", $pid);
      $mail_smarty->assign("email", $v["email"]);
      func_send_mail($v["email"], "mail/productinfo_has_changed_subj.tpl", "mail/productinfo_has_changed.tpl", $config["Company"]["orders_department"], false);
      db_query("UPDATE $sql_tbl[email_for_changed_products] SET descr='".addslashes($query_data_sub["descr"])."', fulldescr='".addslashes($query_data_sub["fulldescr"])."', avail='$query_data_sub[avail]' WHERE productid='$id' AND email='$v[email]'");
      }
      }
    }
# END: SHISHAPIPE UK MOD - theshisha.com 
    }
  }
  }


ShishaPipeUK 11-23-2006 02:32 PM

Re: Notify me when the product's information, price and stock level is changed
 
You need to change the init.php file

Look for this code:

Code:

"download_keys" => "xcart_download_keys",
"export_ranges" => "xcart_export_ranges",


and replace it with:

Code:


"download_keys" => "xcart_download_keys",
# START: SHISHAPIPE UK MOD - theshisha.com
 "email_for_changed_products" => "xcart_email_for_changed_products",
# END: SHISHAPIPE UK MOD - theshisha.com
 "export_ranges" => "xcart_export_ranges",


Now open up your product.php and look for:

Code:


include "./vote.php";
require $xcart_dir."/include/categories.php";


and replace it with:

Code:


include "./vote.php";
# START: SHISHAPIPE UK MOD - theshisha.com 
include "./changed_product_notify.php";
# END: SHISHAPIPE UK MOD - theshisha.com 
require $xcart_dir."/include/categories.php";


OK, last file now, you need to edit skin1/customer/main/product.tpl and place this code in the file.

Code:

{capture name=dialog}
<table width="100%" cellpadding="0" cellspacing="0">
<form action="product.php" method="post" name="notifyform">
<input type="hidden" name="mode" value="changed_product_notify" />
<input type="hidden" name="productid" value="{$product.productid}">
<input type="hidden" name="desc" value="{$product.descr}">
<input type="hidden" name="fulldesc" value="{$product.fulldescr}">
<input type="hidden" name="price" value="{$product.price}">
<input type="hidden" name="avail" value="{$product.avail}">
<tr>
    <td colspan="3">{include file="main/subheader.tpl" title=$lng.lbl_notify_me}</td>
</tr>
<tr>
    <td><br />{$lng.lbl_notify_about_changed_product}:</td>
    <td><br />
  <input type="text" size="25" name="notify_email" value="{$notify_email}"/>
 </td>
 <td><br />
  {include file="buttons/button.tpl" button_title=$lng.lbl_submit style="button" href="javascript: document.notifyform.submit();" type="input"}
 </td>
</tr>
</form>
</table>
{/capture}
{include file="dialog.tpl" content=$smarty.capture.dialog title=$lng.lbl_notify_me extra='width="100%"'}


I would recommend you place this just under your product description, i placed it after the below code:

Code:

{if $active_modules.Magnifier ne "" && ($config.Magnifier.magnifier_image_popup ne 'Y' || $js_enabled ne 'Y')}
<p />
{include file="modules/Magnifier/product_magnifier.tpl" productid=$product.productid}
{/if}


Thats it the full modification for x-cart 4.1.3, enjoy.



Corto_Maltese 11-24-2006 12:03 PM

Re: Notify me when the product's information, price and stock level is changed
 
Hi Shisha,

Do you think that this mod can work on a 4.0.18 version ? I saw that the original mod by Mallromania. And one day, it seemed to me that I saw it on your old site (4.0.18).

Thanks in advance

Erick

pcparts 11-24-2006 05:20 PM

Re: Notify me when the product's information, price and stock level is changed
 
Just cart get this working for some reason any ideas ?
CREATE TABLE x cart_email_for_changed_products
Comes up with some errors

ShishaPipeUK 11-26-2006 10:58 PM

Re: Notify me when the product's information, price and stock level is changed
 
What errors ?

Here is the code in my daily CRON mysql backup:

Code:


--
-- Table structure for table `xcart_email_for_changed_products`
--
DROP TABLE IF EXISTS xcart_email_for_changed_products;
CREATE TABLE xcart_email_for_changed_products (
productid int(11) NOT NULL default '0',
email varchar(128) NOT NULL default '',
descr text NOT NULL,
fulldescr text NOT NULL,
price decimal(12,2) NOT NULL default '0.00',
avail int(11) NOT NULL default '0',
PRIMARY KEY (productid,email)
) TYPE=MyISAM;
--
-- Dumping data for table `xcart_email_for_changed_products`
--
INSERT INTO xcart_email_for_changed_products VALUES (16582,'paul@shishapipe.net','Dubai Tobacco molasses is made in United Arab Emirates, package in a 115 mm square, 75mm depth box with a plastic 250 gram container inside. Dubai Tobacco uses the best quality essences and has a real flavor and is being produced with more than ten different flavors. \r\n\r\n','Dubai Tobacco molasses is made in United Arab Emirates, package in a 115 mm square, 75mm depth box with a plastic 250 gram container inside. Dubai Tobacco uses the best quality essences and has a real flavor and is being produced with more than ten different flavors. ',"25.00",0);


Just add this into your mysql patch in admin area:

Code:


DROP TABLE IF EXISTS xcart_email_for_changed_products;
CREATE TABLE xcart_email_for_changed_products (
productid int(11) NOT NULL default '0',
email varchar(128) NOT NULL default '',
descr text NOT NULL,
fulldescr text NOT NULL,
price decimal(12,2) NOT NULL default '0.00',
avail int(11) NOT NULL default '0',
PRIMARY KEY (productid,email)
) TYPE=MyISAM;


ShishaPipeUK 11-26-2006 11:04 PM

Re: Notify me when the product's information, price and stock level is changed
 
Quote:

Originally Posted by Corto_Maltese
Hi Shisha,

Do you think that this mod can work on a 4.0.18 version ? I saw that the original mod by Mallromania. And one day, it seemed to me that I saw it on your old site (4.0.18).

Thanks in advance

Erick


No this is for 4.1.3, i really don't think it will work on 4.0.18 and i have not tried it on this version either, and i would imagine you will have to make some code changes for 4.0.18.
This mod has nothing to do with Mallromania ( 4.0.18 Price change thread - http://forum.x-cart.com/showthread.php?t=22781 ), if anything it was born via the Funkydunks code (Notify Me - http://forum.x-cart.com/showthread.php?t=2471&page=5&highlight=notify ) which i adapted for 4.0.?? and then changed it for xcart 4.1.? to also include description and price changes as well as zero stock change.

paryaei 02-23-2007 12:31 AM

Re: Notify me when the product's information, price and stock level is changed
 
Thank you very much for this nice mod
I installed it in my shop and everything went OK, but there is one big problem
When a customer types their email in the box and clicks "submit" they get this error message

Access denied !
You are not allowed to access that resource!

Error ID: 33

any idea what is wrong?
thank you in advance for your help

LoveHurts 03-10-2007 07:36 AM

Re: Notify me when the product's information, price and stock level is changed
 
Hi All;

i use X-cart PRO 4.1.6.
& i'm a newbie

Is there no easyer way??
just that costumers can send a mail when its out of stock ??

like this

<Out of stock>
notify me when it's back in stock


Thx in advance

alinush 08-25-2007 08:03 AM

Re: Notify me when the product's information, price and stock level is changed
 
Thank you ShishaPipeUK for posting this wonderful mod.

In case anybody else is interested in this, I got it installed on 4.1.8. There were a few problems:

1. I had to manually insert some of the records in the database (I don't know why it didn't work from the Patch section in X-Cart).

2. in product_modify.php, I had to replace:

Code:

x_load('backoffice','category','image','product');

with:

Code:

x_load('backoffice','category','image','product','mail');

3. Maybe this was related to my custom theme, but I had to remove:

Code:

<input type="hidden" name="desc" value="{$product.descr}">
<input type="hidden" name="fulldesc" value="{$product.fulldescr}">


from product.tpl, as the description was displaying 2 times on the product page.

That's it :) Thanks again.

ShishaPipeUK 01-02-2008 07:55 PM

Re: Notify me when the product's information, price and stock level is changed
 
Works OK on 4.1.9 as well, just some minor changes in the standard code but you can easy follow the instructions and find where to place the code.

You can see an example at http://www.shishapipe.net/shopcart/product.php?productid=16594&cat=296&page=1

This site uses menu tabs so I did not edit the skin1/customer/main/product.tpl code, but instead entered this into the tab code for my site.

I followed my own instructions for 4.1.3 and found there where no code changes for 4.1.9 but just a few changes in the look for code, but you can easy find the area the code needs to be placed without problems.

inmotionmedia 01-12-2008 12:22 PM

Re: Notify me when the product's information, price and stock level is changed
 
This mod sounds great! does the site owner also recieve a notification of which product is "requested"?

ShishaPipeUK 01-12-2008 04:22 PM

Re: Notify me when the product's information, price and stock level is changed
 
No that's not been implemented as when you add the stock back in it automatically emails the people who requested the stock notify, but does not email the admin, sorry.

Also the admin does not know who has requested the stock notify unless you look in the mysql data (xcart_email_for_changed_products), i did not make a back end admin section to look at what emails have requested the change in the product stock or details or price.

The table in the mysql you need to look for that stores the email and product details is:

Code:


CREATE TABLE xcart_email_for_changed_products (
productid int(11) NOT NULL default '0' ,
email varchar(128) NOT NULL default '' ,
descr text NOT NULL default '' ,
fulldescr text NOT NULL default '' ,
price decimal(12,2) NOT NULL default '0.00' ,
avail int(11) NOT NULL default '0' ,
PRIMARY KEY (productid,email)
) TYPE=MyISAM;


Here is an example of one of the entrys:
HTML Code:


INSERT INTO xcart_email_for_changed_products VALUES (16296, 'someones_email@I have deleted.com', '<b>Syrian shisha pipe</b>, elegant in style, fully working shisha pipe.<br><br> Please allow 7 days for delivery on this product.', '<b>Syrian shisha pipe</b>, elegant in style, fully working shisha pipe.<br><br> Please allow 7 days for delivery on this product.', '120.00', 0);


And when you edit the product in admin, either the descr (Description), fulldescr (Full Description), price (The Price) or avail (Stock level from 0 to a greater number) a email will be sent out automatically.

It would not be hard to make a back end admin section to view the emails and products that have been requested for by email address (Look at the wish list code - php and tpl), but i just don't have the time to do this yet, sorry.

TanyaG 05-16-2008 05:15 AM

Re: Notify me when the product's information, price and stock level is changed
 
Not sure what I’m doing wrong but when I’m trying to unsubscribe getting an error message
Notice: Undefined variable: mode in /var/www/vhosts/httpdocs/changed_product_notify.php on line 2
Notice: Undefined variable: mode in /var/www/vhosts/httpdocs/changed_product_notify.php on line 8
Notice: Undefined variable: login in /var/www/vhosts/httpdocs/changed_product_notify.php on line 16

Is anybody know how to fix it.
Many thanks

MBA 05-18-2008 11:26 AM

Re: Notify me when the product's information, price and stock level is changed
 
Works on 4.1.10. I had to manually put in the dif. patching wouldn't work for some unknown reason. We've had this issue with other mods in 4.1.10 too so it may be a bug/change/error with the 4.1.10 patching system?

Either way, nice mod.

TanyaG 12-09-2008 01:03 AM

Re: Notify me when the product's information, price and stock level is changed
 
Thanks a lot for a great mod. Is anybody know how I can add a Confirmation Page (something like: “Thank you for submitting your email....”) and if email address is empty or doesn’t contained @ or . – page saying “Please get back and correct it...”.

Many thanks

donavichi 01-06-2009 03:45 PM

Re: Notify me when the product's information, price and stock level is changed
 
ShishaPipeUK,

This would be useful for a site i'm working on, but i have a question about it.

Because I have a high volume of products to alter when i do an update, too many for x-cart product imports, I insert product details directly into the mySQL database in bulk instead.

Would the mod work in this instance or will it only work if an x-cart induced product import is done?

Thanks in advance,

ADDISON 01-08-2011 12:53 PM

Re: Notify me when the product's information, price and stock level is changed
 
This is a great mod. Thanks for sharing.

I consider useful as a visitor only the following notifications:

- if the price decreases
- back in stock (initial stock 0 - out of stock, if it is changed to positive values - in stock)

ADDISON 03-26-2011 07:32 AM

Re: Notify me when the product's information, price and stock level is changed
 
I would like to ask if this mods allows to unsubscribe. Let's say I am an anonymous visitor and I would like to be informed about price decrease using this feature.

swartzieee 02-22-2012 03:11 PM

Re: Notify me when the product's information, price and stock level is changed
 
Has anyone tested this on XC 4.4.4?

xtech 05-15-2012 11:30 PM

Re: Notify me when the product's information, price and stock level is changed
 
Has anyone for 4.4.2 Pro??


All times are GMT -8. The time now is 11:18 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.