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)
-   -   if a product is outstock, notify when in stock - preorder (https://forum.x-cart.com/showthread.php?t=2471)

markwhoo 05-07-2005 06:26 PM

I just tried using this mod in the 4.0.13 version and am having an error 401 access denied pop up when entering an email address no matter if logged in as a member or not logged in as a guest.

Anyone else use this in 4.0.13 yet, and if so, what was different.

I have tried a few things here, but nothing makes a difference.

shishapipe. any ideas?

jeeya 05-08-2005 02:36 AM

can any one post a complete error correct mod again, as there are too many modifications made due to error in original and it's kind of confusing following it through pages.

markwhoo 05-08-2005 10:59 AM

Well, I am not totally sure here, but I think this is an issue with the guest logged part that was added for non members to be able to use this mod.

When I am a guest and try to enter email, I get the 401 error "Not Authorized."

When I am a member and I see the button to take me ot the page to enter by email, I immediately go to the "Not Authorized" 401 error.

I have played with a couple of lines of code to try to eliminate the guest part to see if remaining will work right and nothing good happens.

I also note that no info is passed into the database as well.

So, what ever is locking up is either the posting of data, or the ability to get passed the authentication TO post the data.

I think I have everyhting installed right here per the instructions and updated info, but it is possible that something has changed in the xcart code to cause issues.


Anyone else have anything to add to this?

Anyone with 4.0.13 try this yet?


I think this is an awesome mod and would be a great addition to the store, but I am having fits at the moment.

jeanne 05-12-2005 08:42 AM

For those of you having trouble with the installation using 4.0.13.
I missed this SQL command below when I first tried installing this mod and was getting the same error as the posters above. It seems to work now.

Code:

INSERT INTO xcart_modules VALUES (2,'stock_notify','Allows registered users to ask to be notified when a product is back in stock','Y');

markwhoo 05-12-2005 04:04 PM

Quote:

Originally Posted by jeanne
For those of you having trouble with the installation using 4.0.13.
I missed this SQL command below when I first tried installing this mod and was getting the same error as the posters above. It seems to work now.

Code:

INSERT INTO xcart_modules VALUES (2,'stock_notify','Allows registered users to ask to be notified when a product is back in stock','Y');


Bless you!

I am not sure how I missed this, but it WAS the problem. At least for submitting the inquiry.

All I need to do is test out nof for product restock and emails to be sent out to end user.

Thanks jeanne, sometimes it is the smallest things that get overlooked.

jeanne 05-19-2005 11:02 AM

Modified to work with variants 4.0.13
 
I modifed this a bit to work with variants and to get the product name in the email that is sent out. I am not much into coding more like messing around until something works, so use at your own risk.

First follow the directions left by sishapipe to install this mod for products without variants. Make sure that it works first before you continue and of course back up all files.

Then I added the field 'productcode' to the xcart_notify table. varchar(32) Don't add the ' s to the field.

In config.php add
Code:

        "notify" => "xcart_notify",
after
Code:

"newsletter" => "xcart_newsletter",

I modified the email files and the files that generate the automatic emails to get the product name sent to the customer.

include/process_product.php
in the code submitted by sishapipe on page 4 of this thread (thanks BTW)

replace
Code:

$mailproduct = func_query_first("SELECT * FROM `xcart_notify` WHERE productid = '$k'");
with
Code:

  $mailproduct= func_query_first("SELECT * FROM $sql_tbl[products] WHERE productid = '$k'");

Replace skin1/mail/stock_notify_subj.tpl with
Code:

{config_load file="$skin_config"}{ $config.Company.company_name }: {$product.product} back in stock !!

in skin1/mail/html/stock_notify.tpl I added
Code:

{$product.product}
that will put the name of the product in the body of the email. You can put it anywhere that it makes sense.

To modify for variants I changed modules/Product_Options/product_variants.php right after
Code:

                db_query("UPDATE $sql_tbl[variants] SET productcode = '$v[productcode]' WHERE variantid = '$k'");
add
Code:

// funkydunk added code for notify when back in stock changed for variants
      if ($v[notify]){
        if ($v[avail] > $v[oldavail]){
// send the email to all registered product watchers
        $mailproduct= func_query_first("SELECT * FROM $sql_tbl[products] WHERE productid = '$productid'");
        $watchers = db_query("SELECT email FROM $sql_tbl[notify] WHERE productcode='$v[productcode]'");
 //echo "SELECT * from $sql_tbl[notify] WHERE productcode= '$v[productcode]'";
        $mail_smarty->assign ("product", $mailproduct); // put in to assign product info to smarty
        $mail_smarty->assign ("userinfo", $userinfo); 
            while ($row = db_fetch_array($watchers)){
// echo $row['email'];
              $email = $row['email'];
              func_send_mail($email, "mail/".$prefix."stock_notify_subj.tpl", "mail/".$prefix."stock_notify.tpl", $config["Company"]["orders_department"], false);
// delete watchers from table
              db_query("DELETE FROM $sql_tbl[notify] WHERE email='" . $email . "' and productcode = '$v[productcode]'");
            }
       
        }
      }
// end of code added by funkydunk for notify when back in stock changed for variants


in skin1/modules/Product_Options/product_variants.tpl right after
Code:

<TD><INPUT type="text" size="3" name="vs[{$v.variantid}][backorder]" value="{$v.backorder}"></TD>
</TR>

add
Code:

{* start funkydunk notify mod changed for variants *}
{if $active_modules.stock_notify ne "" and $v.avail eq 0 and $v.productcode ne ""}
<input type="hidden" name="vs[{$v.variantid}][oldavail]" value="0">
<input type="hidden" name="vs[{$v.variantid}][notify]" value="true">
{/if}
{* end of funkydunk notify mod changed for *}


in skin1/customer/main/product.tpl I added
Code:

{if $variants ne ''}
{if $login ne ''}
<tr><td width="30%"></td><td><span id="product_productcode">{$product.productcode}</span></td></tr>
{else}
<tr><td width="30%"></td><td><span id="product_productcodeguest">{$product.productcode}</span></td></tr>
{/if}
{/if}

I put that after
Code:

<TR><TD width="30%">{$lng.lbl_quantity}</TD><TD nowrap><SPAN id="product_avail_txt">{if $product.avail gt 0}{$product.avail}</SPAN>{else}{$lng.txt_no}{/if} {$lng.txt_items_available}</TD></TR>

in skin1/modules/Product_Options/customer_options.tpl change
Code:

variants[{$k}] = new Array(new Array({$v.taxed_price|default:$v.price|default:$product.taxed_price|default:$product.price}, {$v.avail|default:0}, '{if $v.is_thumbnail eq 'Y'}{$v.variantid}{/if}', '{$v.weight|default:0}', {$v.price|default:$product.price|default:'0'}), new Array(), new Array());
to
Code:

variants[{$k}] = new Array(new Array({$v.taxed_price|default:$v.price|default:$product.taxed_price|default:$product.price}, {$v.avail|default:0}, '{if $v.is_thumbnail eq 'Y'}{$v.variantid}{/if}', '{$v.weight|default:0}', {$v.price|default:$product.price|default:'0'}, '{$v.productcode}'), new Array(), new Array());
after
Code:

var is_unlimit = '{$config.General.unlimited_products}';
add
Code:

var link1 = "<a href='notify.php?productid={$product.productid}&productcode=";
var link2 = "'><font class=FormButton>{$lng.lbl_stock_notify_button}</font>[img]{$ImagesDir}/go.gif[/img]</a>";
var link3 = "&guest=true'><font class=FormButton>{$lng.lbl_stock_notify_button}</font>[img]{$ImagesDir}/go.gif[/img]</a>";

after
Code:

                        if(document.getElementById('product_weight'))
                                document.getElementById('product_weight').innerHTML = variants[x][0][3];

add
Code:

                        if(document.getElementById('product_productcode')){
                                if (avail <= 0)
                                        document.getElementById('product_productcode').innerHTML = link1+variants[x][0][5]+link2;
                                else
                                    document.getElementById('product_productcode').innerHTML = "";
                                }
                        if(document.getElementById('product_productcodeguest')){
                            if (avail <= 0)
                                        document.getElementById('product_productcodeguest').innerHTML = link1+variants[x][0][5]+link3;
                                else
                                    document.getElementById('product_productcodeguest').innerHTML = "";
                                }


For your products with variants the link to the notify me page will only show up when you are out of stock on the variant. I modified the link on the products without variants as well so that it won't show {if $product.avail le 1}...{/if} I am not using the 'Buy Now' feature so I am not sure how that would be afftected.

EnriqueHavoc 07-27-2005 07:15 AM

thanks jeanne :)

also- can anyone tell me if this mod sends an email to the administrator with info on which out-of-stock product the customer was trying to buy?

ShishaPipeUK 08-29-2005 05:15 PM

Re: Modified to work with variants 4.0.13
 
Quote:

Originally Posted by jeanne
in skin1/modules/Product_Options/customer_options.tpl change
Code:

variants[{$k}] = new Array(new Array({$v.taxed_price|default:$v.price|default:$product.taxed_price|default:$product.price}, {$v.avail|default:0}, '{if $v.is_thumbnail eq 'Y'}{$v.variantid}{/if}', '{$v.weight|default:0}', {$v.price|default:$product.price|default:'0'}), new Array(), new Array());
to
Code:

variants[{$k}] = new Array(new Array({$v.taxed_price|default:$v.price|default:$product.taxed_price|default:$product.price}, {$v.avail|default:0}, '{if $v.is_thumbnail eq 'Y'}{$v.variantid}{/if}', '{$v.weight|default:0}', {$v.price|default:$product.price|default:'0'}, '{$v.productcode}'), new Array(), new Array());
after
Code:

var is_unlimit = '{$config.General.unlimited_products}';
add
Code:

var link1 = "<a href='notify.php?productid={$product.productid}&productcode=";
var link2 = "'><font class=FormButton>{$lng.lbl_stock_notify_button}</font>[img]{$ImagesDir}/go.gif[/img]</a>";
var link3 = "&guest=true'><font class=FormButton>{$lng.lbl_stock_notify_button}</font>[img]{$ImagesDir}/go.gif[/img]</a>";

after
Code:

                        if(document.getElementById('product_weight'))
                                document.getElementById('product_weight').innerHTML = variants[x][0][3];

add
Code:

                        if(document.getElementById('product_productcode')){
                                if (avail <= 0)
                                        document.getElementById('product_productcode').innerHTML = link1+variants[x][0][5]+link2;
                                else
                                    document.getElementById('product_productcode').innerHTML = "";
                                }
                        if(document.getElementById('product_productcodeguest')){
                            if (avail <= 0)
                                        document.getElementById('product_productcodeguest').innerHTML = link1+variants[x][0][5]+link3;
                                else
                                    document.getElementById('product_productcodeguest').innerHTML = "";
                                }


This is wrong, it should be in: skin1/modules/Product_Options/check_options.tpl

Pat75 09-21-2005 12:52 PM

not sure
 
I am using 4.0.15 & am not sure if any one else with .15 has uploaded this feature to their website.

If there's anyone pls can you enlighten me on what to do.

Thanks in advance.

LiLCrafter 11-05-2006 11:44 PM

Re: if a product is outstock, notify when in stock - preorder
 
I have added this mod to a 4.0.19 version, however, do not see the mod operational as I have seen it in earlier versions of the 4.0 branch.

Has anyone incorporated this into the 4.0.19 branch? If so, were the calls different?

I know there were multiple changes in code in earlier 4.0 versions, however, not sure what the changes may have been between the earlier or the latest.

ShishaPipe, Have you upgrades your store?

You had the most invested into this mod, so I am sure you have not forgotten it, have you found or implemented changes?

ShishaPipeUK 11-07-2006 07:54 AM

Re: if a product is outstock, notify when in stock - preorder
 
Working on the mod for 4.1.3 will be ready end of November 2006

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, you have the option to unsubscribe to the product notify.

LiLCrafter 11-08-2006 07:57 PM

Re: if a product is outstock, notify when in stock - preorder
 
I guess what I am reading between the lines here is that thismod does not work with 4.0.19 and will at some point in the future operate with 4.1.


Does no one have the 4.0.19 version and have this mod?

I have put this into three carts and this particular version simply does not work at all, so I assume it is a change in call(s) causing problems.

ShishaPipeUK 11-10-2006 07:18 AM

Re: if a product is outstock, notify when in stock - preorder
 
I did have this working in 4.0.19 but now moved to 4.1.3 and changeing it to work.

LiLCrafter 11-10-2006 05:45 PM

Re: if a product is outstock, notify when in stock - preorder
 
Quote:

Originally Posted by ShishaPipeUK
I did have this working in 4.0.19 but now moved to 4.1.3 and changeing it to work.


Do you have any recollection of what the call changes were?

I cannot seem to find what is causing this to not operate properly.

This will be the format for this store period, and it will not be updated after it goes live.

Would be nice to have this capability.

I love this mod too much to not have it, lol.

alphastara 11-14-2006 01:00 PM

Re: if a product is outstock, notify when in stock - preorder
 
I will attempt to install this on 4.0.19 and see if I can get it working and note the appropriate changes...

LiLCrafter 11-14-2006 02:37 PM

Re: if a product is outstock, notify when in stock - preorder
 
Quote:

Originally Posted by alphastara
I will attempt to install this on 4.0.19 and see if I can get it working and note the appropriate changes...


bless you. I tried this and went over everyhting and it appeared to be ok, but it simply did not work.

I took it as a call change somewhere that was not noticed by me, and i am no php guru, just lower level hack you might say.

Level is above beginner, but not expert, lol.

I iwll watch and hope you find what I have missed.

thanks again.

alphastara 11-15-2006 01:03 AM

Re: if a product is outstock, notify when in stock - preorder
 
It had parsed the code for /skin1/modules/stock_notify/notifyme.tpl to links on the pages back, this code works for notifyme.tpl:
Code:

{* notifyme.tpl funkydunk.net 2003 *}
{if $login ne ""}
<a href="notify.php?productid={$product.productid}">{include file="buttons/notifyme.tpl"}</a>
{else}
<a href="notify.php?productid={$product.productid}&guest=true">{include file="buttons/notifyme.tpl"}</a>
{/if}


I have also edited /skin1/buttons/notifyme.tpl to this:
Code:

<font class=FormButton><IMG src="{$ImagesDir}/notifyme.gif" border="0"> {$lng.lbl_stock_notify_button}</font>

It works fine otherwise :) I am going to tweak it a little more and I will post all templates again working in 4.0.19, things I will be doing is adding a link so when the person has entered their email the next screen allows them to go back to the product they were viewing (or category?) and a few other little tweaks....

Keep in mind I havent applied the Varient mods posted on page 9 as yet...

LiLCrafter 11-15-2006 11:01 AM

Re: if a product is outstock, notify when in stock - preorder
 
Quote:

Originally Posted by alphastara
It had parsed the code for /skin1/modules/stock_notify/notifyme.tpl to links on the pages back, this code works for notifyme.tpl:
Code:

{* notifyme.tpl funkydunk.net 2003 *}
{if $login ne ""}
<a href="notify.php?productid={$product.productid}">{include file="buttons/notifyme.tpl"}</a>
{else}
<a href="notify.php?productid={$product.productid}&guest=true">{include file="buttons/notifyme.tpl"}</a>
{/if}


I have also edited /skin1/buttons/notifyme.tpl to this:
Code:

<font class=FormButton><IMG src="{$ImagesDir}/notifyme.gif" border="0"> {$lng.lbl_stock_notify_button}</font>

It works fine otherwise :) I am going to tweak it a little more and I will post all templates again working in 4.0.19, things I will be doing is adding a link so when the person has entered their email the next screen allows them to go back to the product they were viewing (or category?) and a few other little tweaks....

Keep in mind I havent applied the Varient mods posted on page 9 as yet...


Awesome, I will watch closely, thanks so much, looks like you will help me in a huge way by doing this.

I love this mod...

LiLCrafter 11-15-2006 08:21 PM

Re: if a product is outstock, notify when in stock - preorder
 
I have gone back into my files and found that my files match what is shown above already.

I went back into everything further and looked and as stated earlier, it was not working.

I remembered my stopping the smarty.php for looking for changes (to speed up things) and I decided to clear the template cache file to see if it made a difference.

I did not remember if I had done that or not. Upon clearing the cache file, I tested the mod, and it worked...

Looks like my issue was a simple need to clear the cache files out to enguage the mod into action.

Thanks for the attempt at help though.:oops:

tonyhsieh 11-16-2006 03:50 PM

Re: if a product is outstock, notify when in stock - preorder
 
I am looking at the update me when the product is restocked. Was there an upgrade to this mod? and if so, how much? I have the newest version of x-cart

Thanks

Tony

LiLCrafter 11-18-2006 12:13 PM

Re: if a product is outstock, notify when in stock - preorder
 
Quote:

Originally Posted by tonyhsieh
I am looking at the update me when the product is restocked. Was there an upgrade to this mod? and if so, how much? I have the newest version of x-cart

Thanks

Tony


This thread is for people that wish to utilize this mod, they read the thread, install what conserns them (their version) and to use it, you do not pay for it.

There amy be a pay version out there, but it is simple to use this one with full functioality.

I had a bit of an issue with my cahe files and looked like it did not work for my branch, but after reviewing the files, and clearing my cache file several times, it worked for me.

Also, if you are installing this for the 4.1 version cart, wait just a bit, and Shishapipe is going to post updates to get the mod operational of that branch.

Good mod, and it is free. thanks to Funkydunk originally, and then Shisha for bringing it back to life.

ShishaPipeUK 11-23-2006 02:40 PM

Re: if a product is outstock, notify when in stock - preorder
 
Quote:

Originally Posted by LiLCrafter
Also, if you are installing this for the 4.1 version cart, wait just a bit, and Shishapipe is going to post updates to get the mod operational of that branch.

Good mod, and it is free. thanks to Funkydunk originally, and then Shisha for bringing it back to life.


This modification is now posted at http://forum.x-cart.com/showthread.php?t=26853

mitlinks 01-17-2007 06:58 AM

Re: if a product is outstock, notify when in stock - preorder
 
This all sounds great.
Just one thing we, use X-Cart 4.0.18 and 90% of our items are with variants (clothing store :) )
Has anybody this posted mod working with X-Cart 4.0.18 or might the 4.0.19 version (as posted) work as well?
And the more important thing, does it work with variants which are 'sold out'?
I found another thread where you can find a mod at bcsengineering.com and it should be working with 4.0.18 but it looks a bit too much for just a email remainder which is what we want for now.

Thanks for your assistance.

JP908 02-10-2007 08:51 AM

Re: if a product is outstock, notify when in stock - preorder
 
Can a product varient be disabled if "Out of Stock"?
Thanks,

fractalspin 02-22-2007 01:35 PM

Re: if a product is outstock, notify when in stock - preorder
 
any update on this? PMing has been disabled.

fractalspin 02-22-2007 01:44 PM

Re: if a product is outstock, notify when in stock - preorder
 
I have version 4.0.17. Does this mod work with that thread?

It's hard to follow with all the posts


All times are GMT -8. The time now is 04:29 AM.

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