Jump to content

[Module] List of customer out of stock registrations


Recommended Posts

This small module lists registrations for out of stock products done via the mailalerts module. If customers are registered their name is shown. In any case the e-mail and the product is listed.

 

Updated 2010-05-27: Fixed bug for multiple pages

Updated 2010-12-18: Added colors and added delete function

Updated 2010-12-18: Fixed count for attributes

Updated 2012-01-18: Fixed count for attributes

 

/Kjeld

statsoos_0.5.zip

  • Like 6

Share this post


Link to post
Share on other sites
  • 2 weeks later...
  • 1 month later...
  • 4 weeks later...
  • 2 months later...
  • 2 months later...
This small module lists registrations for out of stock products done via the mailalerts module. If customers are registered their name is shown. In any case the e-mail and the product is listed.

Updated 2010-05-27: Fixed bug for multiple pages

/Kjeld


Thanks, Kjeld! Great work, seems to work perfectly with PS1.3.2

Phil

Share this post


Link to post
Share on other sites

I'm using it on SVN 1.4 and have been using it since 1.2.5 - just compared my code (had to make some changes for 1.4 version) and it's still the same base code for the pagination. Should work for you, maybe you don't have more than 20 mail alerts?

Look in the database, in the "mailalert_customer_oos" table to see how many entries you have.

Share this post


Link to post
Share on other sites

It is, I have added a date, but it requires modifying the database and core files, as the date is not recorded in the database by default.

If you are willing to make the changes let me know and I'll post up instructions.

Share this post


Link to post
Share on other sites

No risks, just either have to work around the changes if you update, or apply them to the new version files.

Via phpMyAdmin alter the table...

ALTER TABLE `ps_mailalert_customer_oos` ADD `date_add` DATE NOT NULL



-----[ OPEN ]-----

modules/mailalerts/mailalerts.php



-----[ FIND ]-----

    `id_product_attribute` int(10) unsigned NOT NULL,



-----[ ADD AFTER ]-----

    `date_add` date NOT NULL,



-----[ OPEN ]-----

modules/statsoos/statsoos.php



-----[ FIND ]-----

      SELECT `id_customer`, `customer_email`, `id_product`, `id_product_attribute`



-----[ REPLACE WITH ]-----

          SELECT `id_customer`, `customer_email`, `id_product`, `id_product_attribute`, `date_add`



-----[ FIND ]-----

      '.$this->l('Customer').''.$this->l('E-mail').''.$this->l('Product').''.$this->l('Attribute').'';



-----[ REPLACE WITH ]-----

      '.$this->l('Date').''.$this->l('Customer').''.$this->l('E-mail').''.$this->l('Product').''.$this->l('Attribute').'';



-----[ FIND ]-----

    '.$customerName.'



-----[ ADD BEFORE ]-----

                '.$oosPage['date_add'].'



-----[ OPEN ]-----

modules/mailalerts/mailalerts-ajax_add.php



-----[ FIND ]-----

    REPLACE INTO `'._DB_PREFIX_.'mailalert_customer_oos` (`id_customer`, `customer_email`, `id_product` , `id_product_attribute`)
   VALUES ('.intval($id_customer).', \''.pSQL($customer_email).'\', '.intval($id_product).', '.intval($id_product_attribute).')'))



-----[ REPLACE WITH ]-----

    REPLACE INTO `'._DB_PREFIX_.'mailalert_customer_oos` (`id_customer`, `customer_email`, `id_product` , `id_product_attribute`, `date_add`)
   VALUES ('.intval($id_customer).', \''.pSQL($customer_email).'\', '.intval($id_product).', '.intval($id_product_attribute).', \''.date('Y-m-d').'\')'))



I think these are the only changes, let me know how it goes as I may have forgotten a change somewhere - was awhile ago I added this.

Share this post


Link to post
Share on other sites
  • 3 weeks later...

@zenith: thanks for the hack. very useful.

for the last replace, not sure your parenthesis are correct. mine are like this and that work like a charm :)

if (Db::getInstance()->Execute('
   REPLACE INTO `'._DB_PREFIX_.'mailalert_customer_oos` (`id_customer`, `customer_email`, `id_product` , `id_product_attribute`, `date_add`)
   VALUES ('.intval($id_customer).', \''.pSQL($customer_email).'\', '.intval($id_product).', '.intval($id_product_attribute).', \''.date('Y-m-d').'\')')) 

Share this post


Link to post
Share on other sites
  • 4 weeks later...
Is there a way to delete the fake lists?
There are a lot showing "your@email.com"


yes, would like to be able to delete entries, too. no fakes (yet) but some customers are waiting for products which will not be in stock again, so I would like to get rid of those in the statsoos statistic.

phil

Share this post


Link to post
Share on other sites

I just noticed that when the order comes back in stock, the record is deleted from the ps_mailalert_customer_oos table. Is it possible to not delete it but to flag it as inactive instead?

Share this post


Link to post
Share on other sites

I have improved the module (see first message in the thread).

* It is now possible to delete entries.
* If the e-mail address is invalid it is colored red.
* If the product is not active it is colored grey.
* If the product is in stock it is colored green (save product again to send e-mails).

/Kjeld

Share this post


Link to post
Share on other sites

Thanks Kjeld for the update.

One issue I have found is that a product will be colored green when the attribute is out of stock. Seems you are only checking if the product quantity > 0 not if the attribute of the product that is being watched is in stock.

Apart from this niggle, a great update, I was able to merge it with my modified version seamlessly :)

Share this post


Link to post
Share on other sites

I installed this a few months ago. Is the latest version a big change? Is it a risky update? I'm just on holidays right now and don't want to risk messing up my site:)

Thanks!

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Thank you Kjeld for this extremely useful module, one problem for me after date modifications.
Though the date field is in table and the correct date added and the column date appears on the page before
the customer column as it should, still no date displayed in the results. Any idea about what might be the cause ?
Happy holidays to you and everybody !

Share this post


Link to post
Share on other sites

No, didn't miss it; did all steps, no errors whatsoever. Date is like you said but only in the DB table, the html page renders the date column allright but
empty, everything seems ok, I'm puzzled and clueless.
Thanks for taking your time to help, on holidays Kjeld !

Share this post


Link to post
Share on other sites

Find line 28 in statsoos.php

      SELECT `id_customer`, `customer_email`, `id_product`, `id_product_attribute`



Change to

          SELECT `id_customer`, `customer_email`, `id_product`, `id_product_attribute`, `date_add` 

Share this post


Link to post
Share on other sites
  • 2 weeks later...
I have improved the module (see first message in the thread).

* It is now possible to delete entries.
* If the e-mail address is invalid it is colored red.
* If the product is not active it is colored grey.
* If the product is in stock it is colored green (save product again to send e-mails).

/Kjeld


thanks, kjeld. this fixes exactly what I was about to ask: how to delete entries from the list.

anyway, I am using v0.2 right now, how do I upgrade. Do i just install v0.4 over v0.2 and all is set? or do I have to deinstall v0.2 first and then install v0.4?

best
phil

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hello and thank you for the module.

I installed it with PS 1.3.1. The module showed up in the modules list. I made a purchase of an out of stock product. When I click on stats tab and then Customer out of stock link from the left menu, there is no record of any sale. Any suggestions? I'm using one page checkout, I don't know if it matters.

Share this post


Link to post
Share on other sites

This is not what the module does, it shows a list of customer/guests who have signed up for an e-mail notification on an out of stock item (when items cannot be ordered when out of stock)

Share this post


Link to post
Share on other sites
  • 3 weeks later...
  • 1 month later...
  • 1 month later...

It works OK with 1.4.0.17 except a minor problem, I can see listed only one page if I want to list the next or the last error message is "Tab cannot be found. " so the only way remaining is to look directly in the DB.

Share this post


Link to post
Share on other sites

Change line 73 to

	  <form name="submitStatsOos" method="post" action="index.php?tab=AdminStats&token='.Tools::getValue('token').'&module='.$this->name.'">';

Share this post


Link to post
Share on other sites

Thanks very much for the fast reply, did what you said, had to add an ' after

$this->name.'">

and before ; but now I get the "Security token invalid" message. After that if I press Yes agree, it redirects me to the Stats tab. Any idea why ?

Share this post


Link to post
Share on other sites

Removed both semi-colons after token and module and now the difference is that after clicking on "Understand security risk" it redirects me to the
first listing page, not to the Stats tab as before; the same if I'm selecting any page number from the drop down box, no matter what I do I can see only the first records page.
Thank you having patience.

Share this post


Link to post
Share on other sites

Sorry, my bad, dumb mistake forgot to clear cache.
It's working now !
Big Thanks Zenith, I'm appreciating your help very much.

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Sorry for the dumb question again but where exactly in stats tab is the list of customers who have subscribed? I enabled the feature and subscribed myself but can't find the list nowhere at all.

Actually I would like to change it a bit and use it for subscribing for a certain brands, like zappos does it. There is the option at every product to subscribe for a particular brand only. As I have the stock of 0 for most items, do you think it is doable this way?

Share this post


Link to post
Share on other sites
  • 2 months later...

Thanks for the module I have installed it and it looks great, I have one problem though, when a customer registers to receive a notification of when a product is back in stock, they do not receive it when I increase the stock back up. Instead they receive it when it goes out of stock again?

 

Any ideas would greatly be appreciated!

 

Regards

Kirsty

Share this post


Link to post
Share on other sites
  • 3 weeks later...

Hello,

I have some problems.

After install this module, I've wanted test it. ........ Grrrr problems've arrived.

When i click on Modules and Other modules to see my modules, a # is wrinting at the end of url on my page.

If i want to see all modules, i have a 404 error.

I've decided to use firefox instead of chrome.

I can see all my modules. I uninstall statsoos module but on the page of product i see again this module.

I search, i kill ps_mailalerts... table

I take off 4 lines on product.tpl. Now it's good on my product page but not on admin. I can see all my modules. <div>My website is online and clean because new but close</div><div>What's happen ?</div><div> (Sorry for my french ;-))

 

</div>

Share this post


Link to post
Share on other sites
  • 3 weeks later...
  • 4 weeks later...

Hi,

 

I just install it and it seems great BUT I can only see the first page (on 9 features). When I clic on the little arrow or on the "go directly", I get a error "can't find the tab".

Could you help please?

Thanks.

Share this post


Link to post
Share on other sites
  • 3 weeks later...
  • 2 weeks later...

Thank you for great module.

 

need help, it does not work:

 

Warning: implode() [function.implode]: Invalid arguments passed in www\modules\statsoos\statsoos.php on line 147

 

<td style="text-align: center;"><input type="checkbox" name="oosBox[]" value="'.implode('|', $oosPage).'" /></td>

 

any idea?

 

thanks

Share this post


Link to post
Share on other sites

Sorry, my bad, dumb mistake forgot to clear cache.

It's working now !

Big Thanks Zenith, I'm appreciating your help very much.

 

 

 

which cleared the cache?

I have the same problem: Tab can not be found.

Share this post


Link to post
Share on other sites
  • 1 month later...

Looks very promissing, the first page is showing fine but when i want to go to the next or any other page it tells me 'tab can not be found'.

 

Any sollutions for this?

 

EDIT: I noticed the following

this is the first page

 

index.php?tab=AdminStats&token=739c38fa189696d6ea7dadff0c9f4689&module=statsoos

 

And this another page

index.php?tab=AdminStatsModules&token=739c38fa189696d6ea7dadff0c9f4689&module=statsoos

 

it seems to change the tab name to something else, dont know if this could be the problem, but simply changing the tabname back manually doesn't do anything...

Share this post


Link to post
Share on other sites

Sorry for the question, but I´m new in all this web store stuff, how do I install this module?

 

I already tried uploading to the css/module folder, but then realize the lack of .css file.

 

Thanks in advance.

 

Edit: Nevermind, just figured out... sorry for the spam.

Share this post


Link to post
Share on other sites
  • 4 weeks later...
  • 4 weeks later...

Is there any way of displaying the date in the latest 1.4 version? Statsoos.php has been coded differently so the old find and replaces aren't working.

 

Thanks!

Share this post


Link to post
Share on other sites
  • 1 month later...

Hi,

 

I realise for the same product, only the first guest who enter the email will be shown, subsequent guests who enter emails for the same product will not be captured.

 

Any fix for this problem?

 

Thanks!

Share this post


Link to post
Share on other sites
  • 1 month later...

Great module really because before I couldn't find where to look for the populated product/email list. Now, when I view it under stats, they are all there but when select them to delete it displays:

 

"Tab cannot be found" and obviuosly doesn't delete de entries, any clue?

 

Thanks in adavance!

 

AJ

Share this post


Link to post
Share on other sites
  • 4 weeks later...
  • 3 weeks later...

first of all thanks for the module - again. I used it for PS1.3.2 and now v0.5 also with PS1.4.8.2. but my problem is also (?) that I cannot delete any selection. Also, I cannot access any other page than page 1, I get an 'tab not found' error. any idea how to solve this?

 

disregards. found this and will try it now

http://www.prestasho...post__p__546985

 

EDIT: still tab not found. how do I clear the cache? disabled cache and forced compile for 2 mins but that did not help?

Edited by Pippo3000 (see edit history)

Share this post


Link to post
Share on other sites
  • 2 weeks later...

first of all thanks for the module - again. I used it for PS1.3.2 and now v0.5 also with PS1.4.8.2. but my problem is also (?) that I cannot delete any selection. Also, I cannot access any other page than page 1, I get an 'tab not found' error. any idea how to solve this?

 

disregards. found this and will try it now

http://www.prestasho...post__p__546985

 

EDIT: still tab not found. how do I clear the cache? disabled cache and forced compile for 2 mins but that did not help?

 

anyone? please

Share this post


Link to post
Share on other sites
  • 2 weeks later...
  • 2 weeks later...

I am using PS 1.4.6.2 and facing the same issue when clicking on page 2 or trying to delete (Tab cannot be found.Tab cannot be found.). I tried some of the solutions but none of them worked, although the module/scripts work nicely storing the emails and sending notifications when available. Anyone know a remedy? Thanks in advance!

Share this post


Link to post
Share on other sites

unfortunately not. a real pity as this is really a functionality PS should have out of the box...

 

EDIT: reading helps and sticking to the letter. when applying the changes mentioned above I missed a ) or ; somehow, tried it again now and yes, it does work. just stick to the code by the letter

Edited by Pippo3000 (see edit history)

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hello

 

Same problem here, can't delete records.

When i try to delete a record i have message "Tab cannot be found" and a white screen.

 

Any advise?

Thanks

  1. Open up statsoos.php
  2. at line 78 you will find something like the following:

  • action="index.php?tab=AdminStatsModules&token=
  • Change it to the following:
  • action="index.php?tab=AdminStats&token=

Try it out

Share this post


Link to post
Share on other sites
  1. Open up statsoos.php

  2. at line 78 you will find something like the following:

 

  • action="index.php?tab=AdminStatsModules&token=

  • Change it to the following:

  • action="index.php?tab=AdminStats&token=

 

Try it out

 

 

Dude that actually worked, thanks as I was already on my third page and this is a very helpful module,

 

If anyone need I can send the working module with date column and without bug on scrolling next pages. Marco

 

 

Dude email it to me please at aacostacr at hotmail dot com

Share this post


Link to post
Share on other sites
  • 2 weeks later...