How to start with a different Customer ID in Magento? - magento

In Magento Community v1.5.1.0, how would one go about setting the starting (or next) Customer ID? By default, the first Customer ID is 1. I need to start at Customer ID 300000 after clearing out test data before moving a store into production.
Order, Invoice, Shipment, and Credit Memo ID's can be changed by updating the appropriate values in the eav_entity_store, but (contrary to the information here) there is not an increment entry for Customer ID there.
I scanned the database for a "customer"-related table that would achieve the same thing as eav_entity_store but no dice, and my Google-Fu failed as well.

I thought it was not possible in magento, But it will done by MySql query. Run the below query manually and you will get the user id starts from 300001
ALTER TABLE customer_entity AUTO_INCREMENT = 300001;

There is no increment for customer in eav_entity_store but one can be created, perhaps in a module's install script...
$customerType = Mage::getModel('eav/entity_type')->loadByCode('customer');
Mage::getModel('eav/entity_store')
// customer increments are not per store so store_id is 0
->loadByEntityStore($customerType->getId(), 0)
// increments are varchar, not ints
->setIncrementPrefix('3')
->setIncrementLastId('300000')
->save();

Related

Is there a method to distribute new registered customers to existing employees in the database by order in Laravel?

I designed this laravel app for a business where customers can register on the website and employees can manage them from the backoffice,I want this management to be automatically fair, which means that each time a customer appears in the database, he will be assigned to the first employee, if tomorrow another customer shows up,he will be assigned to the second employee,...
is there a way to do this task? i heard that laravel Scheduling is similar to what i want but how can i keep track of the last employee that been affected a client? so each employee can get same amount of clients , and not only the first one gets to have them all.
You can add a assigned_at column and store the time that customer was assinged to employee. Now you can find last employee by sorting by assinged_at column. To find next employee you can sort employees by id and find next employee after this one.

session for multiple devices

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.

Any way to intercept an error message and make more user friendly?

I have looked for an answer here among other places but havent quite been able to find what I need to know.
I have 3 tables, Order_Details, Products_Ordered and Product_Details. The first two are being used in a master detail form to show the order and the items ordered together. The Products_Ordered table has a composite primary key made from two foreign keys, the first being the primary key from the Order_Details table, and the second being the primary key from the Product_Details table. Together they ensure that a type of product can only be added to an order once. If someone wants to order more than one product then the quantity field in the record can be altered to reflect this. All that seems fine so far.
My issue is that when adding products to the order in the master detail form i have used a drop down list of values to select the product to add to the order. the display value for this is the product name and the return value for it is the primary key for the product from the Product_Details table.
I like this because its easier for the user to simply select the product and add a quantity of it to the table. And it works fine for both insert and update operations apart from one situation.
If the user selects the same product in to rows then submits the table the database then tries to add the product to the order twice, throwing a "ORA-00001: unique constraint violated." error. Obviously this is because of the product ID being used in the primary key of the table.
I don't want to allow the user to add two records to the table like that, rather id like to force them to alter the quantity field accordingly. The error message that comes up isn't very user friendly so my question is how can I detect this error and display a more user friendly one instead telling them to alter the quantity field instead?
*If this isn't possible then is there a way that I can hide any already selected products from the dropdown list of values in the following table rows? I haven't looked into this too much because surely it would get complicated when the user tries to add more rows than products available in the dropdown and there are no more products values to show?
I am quite new to this so please be nice. Any help is greatly appreciated :D
Here is a link where all is nicely described:
https://docs.oracle.com/cd/A97630_01/appdev.920/a96624/07_errs.htm
Section
Predefined PL/SQL Exceptions
in combination with:
Defining Your Own PL/SQL Exceptions
and
Defining Your Own Error Messages: Procedure RAISE_APPLICATION_ERROR
Hope it helps...

Magento order_id increment is inconsistent(seems to have jumped one value)

I have noticed that in my Orders grid in the admin, all the(hundreds) of orders have sequential order ids, all but one. I have 100000103 and then 100000105.
The 100000104 is missing. I have checked this post(magento order id increment jumps) on StackOverflow, but the answer there suggests the following:
If you want to find your 'missing' increment_ids, take a look in sales_flat_quote under the field reserved_order_id. You should see them attached to unconverted quote objects (carts).
But I do not have the missing ID in the specified table for the reserved_order_id column. It is also missing from there, the IDs go 103 and then 105..
I have also checked the abandoned carts reports grid, it is empty.
Should I be concerned that there was some error? The shop owner says he is worried that some order is missing or something..
This is normal, take a look # magento order id increment jumps
When Magento enters the checkout process it 'reserves' an increment_id
and places it on the quote (cart) object and if customer change their mind there will be a missing order id.

How to reset the ID of customers in magento

In my magento admin panel there have Customer ID as 9756.
I need to reset it start with 1.
How can i do this?
You cannot do this (easily) unless you want to remove all customers by truncating the table customer_entity.
Actually you can do this without losing the customers, by changing the id of each one of them starting with 1 and then changing the auto-increment of the customer_entity table using ALTER TABLEcustomer_entityAUTO_INCREMENT = 10; (the value of the autoincrement must be the last id + 1 or it wont work).
I don't recommend this since you can do a lot of damage trying it. The id is used internally so it shouldn't bother you much, unless your OCD sensors are tingling :).

Resources