session for multiple devices - session

I am trying to build an ecommerce site.for the cart functionality I want to alive my cart for multiple devices.For example if I create an account and add some product to my cart using my mobile browser,after that if I use the same account to my pc browser I should see the cart with those product I added using my mobile browser.I donno how to do that or what's the method,can you please help me??

My Preferred Approach
In order to do this, you'll want to create or leverage some sort of profile data source. For example, if you're using a database, you likely have a Users table with a record for each customer. I'd suggest adding a new related table that might look something like this to begin with...
Potential Table Name: UserData
UserID (FK)
DataName (string)
DataValue (string)
So, after logging in, the visitor might add something to their cart. When this happens, you'd have a CartID to work with and then add a record to that table with their UserID and it might look like this in T-SQL.
INSERT INTO [dbo].[UserData] ([UserID],[DataName],[DataValue])
VALUES (12345, 'CartID', 'd501e3de-350c-4c20-92c8-8e71445e1774');
Now, when they log in again anywhere, you'd just query for that UserID to find out if they have a cart pending. If they do, load it up. Just remember to clear that value on checkout.
The beauty of this solution is that you can repurpose it for all kinds of other things.
An Alternative Approach
Just query your Cart table, assuming in your solution you're storing carts before checkout is completed. Find the most recent instance of a cart matching their UserID that hasn't been completed.

Related

woocommerce cart session duplicating

I have a client who is experiencing issues with their Wordpress/WooCommerce website.
Issue: The website is automatically adding products to the cart (Roughly 40-60). The issue occurs for both logged-in & logged-out users. The issue can occur when trying to login to the My Account section, when adding items to the cart or sometimes after adding items to the cart and then visiting the cart it will override cart items with new random items.
I have noticed that in WC_Session_handler the value for _customer_id is often not unique nor is the other session data.. I have removed all server & front-end caching, searched for any other sessions initialized.
Any help would be appreciated as they are losing business due to customers not being able to remove the items from their cart (As the removed items re-appear quickly)..
Domain Name: thecoffeehopper.com :)
The cart is constructed from data in the wp_woocommerce_sessions and wp_usermeta MySQL tables.
I would run the following sql queries to try and find the source of your problem.
select * from wp_woocommerce_sessions;
select * from wp_usermeta where meta_key like '_woocommerce_persistent_cart_%';
The data from these rows are used to construct the cart. Are the random items found in any of these rows? The rows have a user id or customer id to tell which customer the data belongs to.
The data in these rows are serialized strings and is difficult to read directly so I would use the WordPress CLI tool and apply the function maybe_unserialize() to the SQL results.

Query to find order products for related accounts in Dynamics CRM

On the Accounts form, I want to be able to show all Order Products for that Account and any related Account. My aim is to give the user an easy way to see what has been bought by a customer with several related offices (Accounts).
Any idea how this can be done?
There is a way to do this with a plugin. The general steps would be:
Ensure the view that is used on the order product subgrid on the Account form is not used anywhere else.
Make a unique change to the view columns or filter criteria that will let you distinguish it from other views. For example, you could add a condition of "createdon contains data", which most likely would not be used anywhere else
Create a pre-RetrieveMultiple plugin on Order Product.
In the plugin, get the query from the input parameters and check for the "createdon contains data" condition. If it does not exist, exit the plugin.
If the condition exists, this is the view you want to update. In the query, find the condition that has accountid.
Use the accountid to retrieve related child and parent accounts.
Update the query with a condition checking if accountid is in the list of all the accountids you retrieved.
The query should now return all the relevant order products and display them on the Account form.
This is a rather involved solution with only the high level steps outlined here.
Here is a link that shows an example of modifying a query in a pre-retrievemultple plugin:
https://hachecrm2011.wordpress.com/2013/07/19/filtering-views-by-intercepting-retrieve-multiple-queries-with-a-plugin/

Magento checkout method recorded in database

Is the Magento checkout method recorded anywhere in the database.
I know the value can be accessed during the session i.e. register, guest etc but after the order is placed is the value recorded anywhere?
Anton S gave a good answer but if you need more help viewing tables and their fields in the Magento database, this is a really useful tool.
http://www.magereverse.com/
Simply select your version of Magento and then start selecting tables. It gives you correlations between various fields in the tables as well, which can be helpful when tracking down entity data.
Hope this helps!
Checkout method is stored in the sales_flat_quote table in the customer_is_guest field. A value of 1 indicates the customer checked out using the guest checkout option. A value of 0 indicates the customer checked out using their account. You can access the quote using its id from the order object.

Magento: how do I determine if a customer is new?

I want to be able to send different order confirmation emails to new customers than to established customers.
I am already able to put a block in the email template to insert my own 'if' constructs based on order details.
I can get the customer data from the order id, e.g. the customer id, but how can I determine if they are a new customer?
Even if it is getting the customer creation date and checking if it is less than five minutes, I need a technique to determine if they are new from within my template code based on the order information.
Either way your going to just have to do calculations on created_at field in the customer_entity table. If not your going to have to find some specific window to consider customers as "new".
Don't think I'd put said logic in the template file but rather a model and just pass it a block to flag it or not.

Creating a Relationship Between Order Product (salesorderdetail) and Service Activity (serviceappointment)

We are using Microsoft CRM 4.0 to run a consulting business. Its working pretty well but we want to simplify the way we are doing some things. What we want to do is create an Order (salesorder) with multiple Order Products (salesorderdetal). So good so far.
Next I want to be able associate each Order Product (salesorderdetail) with a Service Activity (serviceappointment), this representing that this billable line item in the order is actually going to be fulfilled as a consuting engagement.
The problem is, I can't seem to be able to create an association between the Order Product (salesorderdetail) and Service Activiy (serviceappointment). It simply doesn't appear in the drop downlist.
Can anyone think of a reason for this? I've seen some posts about relating field mapping between Quote Product, Order Product, Opportunity Product and Invoice Product, but that isn't quite what I am after.
Any suggestions gratefully received - even if it is an explaination of why its not possible.
I created a simple 1:N mapping from Case to Invoice. The Case records its ID and Title in custom fields in the Invoice. Unfortunately this does not allow for product creation as children of the Invoice, so that should be created as a custom code workflow.

Resources