Auto switch customer group in magento - php

Has anyone found a way to auto switch a customer group based on specific rules? For example, if a customer over their lifetime has ordered 200 plus bottles of something they are grouped in a specific customer tier and get special pricing (wholesale type situation)
I know how to do segments of customers but that doesn't help me auto change which customer group they belong too.
Thanks in advance for any help in the right direction...

there are a couple of payable extensions at magento connect or you can create simple module with custom actions. Article for a good start.

In case someone is still looking for an answer, this extension (which I created) can do exactly what you are looking for and more out of the box:
Website:
https://plugin.company/magento-extensions/automatic-customer-group-switching.html
On Magento Connect:
http://www.magentocommerce.com/magento-connect/automatic-customer-group-switching-by-plugin-company.html
If you'd like to build your own custom functionality though, I'd recommend looking into the sales_order_placed_after event and getting the order history details by filtering an order collection on the customer ID that has placed the order.
Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id', $yourCustomerId);
You can then loop through each order and get all items by using the getAllItemsmethod.
Alternatively you could retrieve a sales_order_item collection, and join the corresponding order details from the sales_flat_order table. Then you could filter on customer ID and product ID and group the results on product ID.
You can then base your customer group switching logic on the sum of the total ordered product quantity.

Related

Prestashop customers groups

Prestashop 1.7.5.2
I have a group of customers in particular (the 43). For this group of customers, I would like that from the "my account" section, there is a link that directs to a list of specific products to add to the basket and only these products (which I will select by id I imagine ).
This option should only be available for customer group 43.
I really have no idea how to do it.
Do you have any ideas I could explore?
Thanks a lot
A list of specific product for a specific customers group to add to the basket
You'll need to restrict your customer group to access a single category to which you will need to link the products you intend to offer.
Then you'll need to develop a simple module hooked into the customer display account hook to display a link to that category, if customer belongs to that ID group.
If you are not familiar with Prestashop and module development there are a few concepts you will have to learn, you can start here

MySQL DB design for a products rental with pricing history

I'm designing a database for product rental. I'm using Laravel 8 framework.
prices change all the time.
The rental order requires a quote generated by the client.
The prices are stored but not listed in the user view, they are only for reference in the admin order quote generator view.
The client wants to be able to change the price for each quote before sending it as their specific client may need special treatment.
So, summing up, I need:
To store a record for the price of a specific order quote.
To store a base price and a history record of this price.
To be able to list the available products in between two dates filtered by the status of the order, which will change until the final approval of the quote. Also filtered by the stock available.
Have additional costs associated to the specific order.
Different total price for deferred payment.
This is what I came up to, I have a table for:
Orders
Products
Order_Product (this name format is required by laravel's eloquent)
Products_Prices
Additionals
Orders_statuses
In the order_product table I'm planning to store the price defined for the client, and the count of rented products. Also foreign keys for a many-to-many between products and orders.
In the order I'm planning to store the "pickup" and "return dates to query first WHERE "orders with approved status" BETWEEN the two dates selected by the user. Finally get order_products with a NOT IN to display the available products.
The products_prices table I use it to store the changes record.
In the products table I have availability because the product may not be available for rent for many reasons for a period. Stock and colors that I will use for ordering the list because of a requirement from the client so I go first for primary color, secondary and tertiary afterwards.
I'm not sure if this is the most efficient way to achieve what I'm looking for. Since I will need to check products availability all the time I need to be sure that this is the fastest and more reliable one.
I'm not english speaker so I feel the need to clarify this:
The client = My client.
User = My client's client.
Thanks in advance!

CS Cart Specific price per user group

Is it possible to add second price to each product and use that price if user in specific usergroup?
I was thinking doing that by adding another column to the product price table and then take advantage of the promotion function to somehow use that price instead of the usual discount you can set from admin.
Any pointers or ideas would be great, thank you.
Yes, it is possible to define price for product that is valid/shown only for users in specific usergroup.
To achieve this you need to use Quantity discounts tab on Editing product page.
Name of this tab implies as there must be some large amount of items bought (like volume discounts...), but quantity can also be just 1 item.
For this you first need to define usergroup (Customers->User groups).
Example is shown also on CS-Cart Knowledge base: Wholesale Prices
Best regards,
Bostjan
It is default CS-Cart feature. Please check the following article in the database:
http://kb.cs-cart.com/wholesale-prices

Getting product weight info in virtuemart inside order details/order history page

I have the following problem in virtuemart:
I have made a function to calculate shipping cost based on a five stage cost given by the shipping company. This works perfectly on the cart page, but on the order details and order history page it does not, as I cannot get the product weight in these pages.
I have looked into order_items.php where the order details references are kept, but there is no reference to the product weight, only to product id, quantity, category, etc.
Could anyone help me in how to get the product weight inside the order details page? I can do the rest in calculating the shipping rates and updating the final sales price, but I am stuck in getting this info.
Any help is welcomed :)
Try this,
I think you missed something about order tables, hope you are using VM2.x
In this version once the order is processed its payment,shipment information gets saved on the #__orders table.
In additionally the payment method Id and Shipment method Id also gets saved. So you can identify the method used on the order.
The idea of calculating ordered products shipping cost later on admin side is not practical bcoz later the shipping cost may very.
So practically once the user placed an order that time you have to save these information on the above table. If you're using VM default Shipping plugins they will do this by default.
Hope its clear.

Limit product quantity to 1 per customer in magento

I need to limit the quantity of a product purchased by a customer to 1 per day. We are going to have something like deal and day and targeting consumers. We do not want some one to buy high quantities. Could some one guide me as to what the general approach should be to do this? Thanks.
I noticed that there is a table sales_flat_order_item which contains products_id for an order, a join of this table with sales_flat_order should give me product_id for the orders placed by the customer. How do i access this table data directly and perform the join operation the magento way? Do i need to create a new module? or modify a existing module?
You could just create a coupon/coupons for this. Leave the product at the original price and hand out a coupon to the targeted customers. Make sure that you set it to "only applies to 1 item" and can only be used once.
Regards,
Kenny

Categories