Create an Abandoned Cart email notice (using AcyM)

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #108205

I'm trying to get the combination of HikaShop and AcyMailing to send out a True 'Abandoned Cart' notice to users who don't complete their order. However, I'm running into problems - that appear to be on the HS end of things.

Using the AcyMailing tools I can send out a notice if an order is 'created' but never paid; however, that doesn't work because HS isn't creating an order (with the status of "Created" - or any other status) until the order has been processed (using Authorize.net). The only time that I ever get an order sitting with status of 'created' is if I use offline payment.

I see that the _hikashop_cart table has a bunch of entries in it, but all the 'user_id' fields are "0".

The customers are entering their address info (including email) into the address area in the first step of the checkout process. We are NOT having users register (Login: No | Registration: No registration)

Is there any way to 'get' that email address that was entered so that we can send an email reminder (without having registration enabled)?

It looks like that data is only saved as part of the 'session' - but I can't find any way to get at that data.

Is it possible?

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #108207

OK ... partly able to answer my own question here ... the email address IS recorded in the session table, but I'm not 100% sure of the format of this data.

Are there any docs about the way data is stored there?

It should be pretty easy to write a simple plugin that would create an 'actionable' joomla table (a table that has use info - esp. email - and possibly even product info.

OR

Is there any way to TELL HS to store this data in the orders table in HS earlier in the process?
(I'd REALLY like to avoid having to write any custom code if there is a way to just get these orders put in the _order table earlier in the process)

Please Log in or Create an account to join the conversation.

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 4 months ago #108246

Hi,

www.hikashop.com/en/support/documentatio...ocumentation.html#db

I don't understand your question.
A user who have an account will have his cart stored in the database and linked to his account. We could have his email.
An anonymous account whil have his cart stored in the database and linked to his session. We couldn't have his email, he does not have an account.

There is a difference between a cart and an order.
An order will be created when the user will try to validate the checkout, depending the payment plugin, the order will be created in the database or not (with the "created" status if so).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #108266

We need an 'abandoned cart for non-registered user'. (not an abandoned 'order')

This is a standard function in eCommerce configurations.

The data IS available after step one of our check (where they enter their email/address) - it is being stored in the session.
The email IS available after the order has been paid (i.e. 'created' and then 'completed').

We'd just like to get the cart data made into an 'order' sooner in the process if possible (IF we can control that).

OR

What are others using to have a true abandoned CART with non-registered users?

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108386

As Jerome said, once the user is registered/logged in, the cart is linked to the user.
It is not stored in the session but in the database.
So you simply need to use the link between the cart_user_id column of the cart table and the user_id column of the user table of HikaShop to get the email stored in the user table to be used in the filtering system of AcyMailing with their universal filtering plugin.
There is no need to mess with the session table of Joomla and that wouldn't help anyway.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #108496

As I noted, it needs to handle non-registered users.
We cannot ask users to register on the site AND we can't have HS do auto-registration because then they are forced to login (and remember a password that they didn't set) when they try to shop on subsequent visits.

I NEED to have it so that the 'abandoned cart' notice can be sent for a user who completes the address area, but doesn't complete the order for a system where the users are NOT registered.

It seems like this should be possible because HS does store this information (even for non-registered users) at a later step in the checkout process.
It would be helpful if there were a way to change this and make it happen sooner in the process (i.e. as soon as they enter their email address/full address).

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108683

It's the same for non registered users.
Their email address is also stored in the user table of hikashop and linked to their cart. So the same technique I gave in my previous message will work regardless of the registration mode that you configured in the configuration of Hikashop.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #108716

Yes, however, the data is not being stored into those tables until much later in the checkout process. Actually, there is NEVER an order that is at the state of 'created' (the default for our shop) when using the authorize.net payment plugin.

I have tested and watch the data in the db tables, if the user enters their email/address (in the first step) but never proceeds beyond that there is a session record saved (in the Joomla sessions table) with all their data; however, there is nothing in any of the HS tables yet. That's what I need to access. Or better yet, I need to have that data stored at that point (right after they enter the address).

At this point it appears that HS doesn't save the 'cart' in a table, but only a completed 'order'.

I know that the data is there in the session table, so the data is being captured.

Is there a way to modify the checkout process to actually save that cart data into an order earlier in the process?

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108719

The data is not stored later.
It is stored directly when the user enters his information.

The order is indeed only created at the end of the checkout. But if you read carefully my previous messages, I'm not talking about the order but I'm talking about the cart.
The cart data IS linked to the data of the user directly after the user enters his information NOT at the end of the checkout. I quote:

So you simply need to use the link between the cart_user_id column of the cart table and the user_id column of the user table of HikaShop to get the email stored in the user table to be used in the filtering system of AcyMailing with their universal filtering plugin.


Again, there is no need to change any code to save the cart data in the database. It is already there but not in the order table, in the cart table !

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #108722

All of the entries in the table _hikashop_cart in the column user_id are set to "0".

I just tested and the user IS being added to the _hikashop_user table.

Is there a step in the checkout process that sets this that might be missing?

[EDIT: If you can just point me to the file/code that sets this I can dig through the code on the site to see if it's somehow modified or missing.]

Last edit: 11 years 4 months ago by cpaschen.

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108940

Ah that's possible. we don't rely on the cart_user_id as the cart_id is directly in the user session so it's not impossible that the cart_user_id is empty.

The best would be to edit the file plugins/system/hikashopuser/hikashopuser.php and add a query to update the cart table to set the user_id in the cart_user_id of the current cart based on the cart_id in $this->cart in the function onAfterStoreUser.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #108951

OK ... I'm getting a bit confused here.

First you say

So you simply need to use the link between the cart_user_id column of the cart table and the user_id column of the user table of HikaShop

Now you say
Ah that's possible. we don't rely on the cart_user_id as the cart_id is directly in the user session so it's not impossible that the cart_user_id is empty.

So, should it be updating the cart_user_id by default?

If not, if I make the changes indicated I'm guessing that the changes will be overwritten upon next update?

I really don't want to 'hack' the code. And it appears that this process (storing the cart_user_id SHOULD be happening by default.

Do you have any existing sample code of what this should look like (or that you might consider adding to next release to make this work properly)?

[BTW ... I originally asked about using the data in the session and I was told not to use that.]

Last edit: 11 years 4 months ago by cpaschen. Reason: add note about session use.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #109108

Can someone please let me know IF HikaShop actually should be storing cart_user_id data in the cart table. And if so, where the code is that does that so that I can try to de-bug this?

I'm starting to move from confused to frustrated over this issue. We've been trying to get this to work based upon other posts on the forum for several weeks now.

If HikaShop doesn't have this code please let me know so that we can address this with custom code (and so that others trying to create an abandoned cart don't have to go through the same process).

Also, if it doesn't have that code, could you please provide me with some idea as to the structure of the data that is stored in the session table (or a reference to the code that stores it) so that I can go back to my (almost first) idea to just create a plugin to pull the data out of there for this process.

Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #109147

I thought that this was the case that the cart_user_id always contained the user_id. But it seems that you some cases it is not the case, like you saw in your database. That's indeed something which should be done during the registration in the user plugin as I explained.
If you do the code and that it's working as I explained in my previous post, we'll of course be glad to include it in next version so that everyone can benefit from it. Once the cart_user_id is filled in the cart, you will be able to use it in your filters in AcyMailing as I explained from the beginning.

We didn't saw that until know because when we load the cart for a specific user, there are several layers of and we rely on both the database and user session. So that's why it's not a problem unless you want to do something like you want which didn't happen until now.
I was not saying that you should rely on the user session. I was merly explaining why the cart_user_id was missing and that we didn't saw it until now.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #109316

OK ... so it appears that the user_id IS being stored IF the user logs in (i.e. is registered), but not if we go with the set-up to allow non-registered users.

So, any idea where the code is located that is doing this (storing the data for registered users) and where it should go for non-registered users?

OR would you be willing to make this change if I can 'sponsor' it?

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #109429

Here is what I would try to add:

$cartClass = hikashop_get('class.cart');
$cart = $cartClass->loadCart();
$cart->cart_user_id = $this->user_id;
$cartClass->save($cart);
after the code:
			if(!$this->user_id){
				$this->user_id = $this->save($userData);
			}
in the function register of the file administrator/components/com_hikashop/classes/user.php

That should save the user_id of non registered users in the cart_user_id of carts after entering their email/address on the form of the frontend (what you want).

Let me know how that goes. If it works fine for you, we'll add it to next version.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #109957

That doesn't seem to work.

Also, that section of code:

if(!$this->user_id) {

Only appears in the section:
if($simplified==2)

section of the registered function.

It would seem (unless I don't understand the code logic) that it shouldn't go there for our system, because we aren't using the simplified registration - we're using NO registration.

But I'm not completely sure what the various values of $simplified represent.

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #109968

Simply look at the HTML of the option in the configuration and you will see which value correspond to which option:

<select id="configsimplified_registration" name="config[simplified_registration]" class="inputbox chzn-done" size="1" style="display: none;">
	<option value="0">Registration</option>
	<option value="1">Simplified registration</option>
	<option value="3">Simplified registration with password</option>
	<option value="2" selected="selected">No registration</option>
</select>

And as you can see, the value 2 is for the "no registration".

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 5
  • Hikashop Business
11 years 4 months ago #110131

OK ... thanks for explaining that.

Tried again (and tried positioning it in several places) but still not working.

Hmm ... I might have to test on a 'clean' install just to make sure that we're not running into any previous configuration modifications causing the problem.

Please Log in or Create an account to join the conversation.

  • Posts: 82758
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #110276

Ok, I tested on my end and it should be:

$cartClass = hikashop_get('class.cart');
$cart = $cartClass->loadCart();
$cart->user_id = $this->user_id;
$cartClass->save($cart);

Last edit: 11 years 4 months ago by nicolas.

Please Log in or Create an account to join the conversation.

Time to create page: 0.086 seconds
Powered by Kunena Forum