Magento Product Reviews only by customer who purchased the product - magento

I searched everywhere, but could not find the solution for this. I want to not allow others except the buyers of that product to add review for that particular product, in Magento. Please can anybody help with this.

Initally make the option "Allow Guests to Write Reivews" to "No". Now, you can make this by taking the order collection of a particular product by getProductOrderCollectionById(). From that order collection we can get the list of the customers who purchased it.
In the other hand, you can get the ID of the logged-In customer. If the Order collection list contains the logged In customer ID, then you can allow them to display the review form.

Related

How to limit number of order per customer for certain product? - Magento 1.9

I have a requirement in my website where the customer can buy a certain product only once. If they try to buy that again it should throw an error saying cannot purchase this again.
Please help me on this.
If it is only one or few products like that - the best way in my opinion is to add attribute to customer and change it after product is purchased.
Thanks for your question...
Solution:-
1- You've to create product attribute as Yes/No & by default, it'll be No.you've to select as Yes for the product which you want to avail purchase only once.
2- If a customer is logged in, then during Add to Cart if a product can purchase only once for a customer then before adding to cart(use observer here) you've to check if a customer already purchases this item if yes then you've to avoid
Add to Cart else customer can add this to cart.
3- If a customer is not logged in, in this case, it depends on you.
There may be 2 cases:-
a- Simply customer can be added to cart any item & after login, if a customer has added the restricted item(only once purchase) then you've to remove the restricted item from the cart if already purchased else vice versa.
b- OR you don't allow to Add To Cart(by an observer) restricted item if a customer is not logged in.
Hope it'll resolve your problem.

How to validate shipping address per product by city and restrict user?

I am using Magento 1.9. I want to create product and make available in only specific cities. And also I want to restrict users on checkout when they select product to ship in the city where the product is not available.
I am a beginner at Magento and don't know how to achieve this.
What I have in mind so far is, it will be good to create an attribute named 'city', make it multiselect and add cities as it's options. So now I can create product and assign multiple cities to it. and can be seen at the 'Additional Information tab' on frontend product's page.
But now I want to restrict user if he select orders product available in "New York" and he submitted shipping address with any other city. This should restrict the further process and display message.
In short, I want to restrict user on checkout and display message. "The product is not available in the specified address/city/location etc"

How to apply "20% Discount" to specific Customers of a Customer Group in Magento 1.7.2?

I have products with a normal price(let's say product A costs 20e) and a group price(lets product A costs 15e) assigned to my customer group
that I call it "Resellers".
I want to apply an extra 20% discount to specific Resellers (not to the whole Reseller group)
in the group price(meaning the 15e)
I tried to solve it by creating a "Shoping Cart Price Rule" (I called it "20% Extra Discount") it applies to the whole Customer Group
How Can I apply 20% it only to specific Resellers and not to the whole Reseller Group for the group price only?
What you are asking is not possible with Magento out of the box.
You can overcome this by generating a coupon that you can send out by e-mail to your specific customers.
or you can try to use an extension like this.
It's not free, but from the looks of it it might get you what you need.
I'm in no way associated to the extension provider. I just found it on a simple search on the web.
You need to do some coding in order to achieve above said, following is the way it should happen.
You would need to hook into an event, ex :
Changing the price in quote while adding product to cart: magento
Also in the observer created above you need to do something like
Add custom discount order in total with button
Now whats above will do :
Let us suppose you create a general rule for 20% discount but do not relate it to any customer group.
What happen is once a product is added to a cart you can check into an Observer whether you want to provide discount to this particular customer.
If yes programmatically add coupon to the quote or order else not.
Please note : there are various other type of event for ex: after moving to checkout etc, in case you do not want to use on adding of product to cart.
hope above helps.

Programmatically apply a discount price in product list

I would like to programmatically display a discounted price on the product list/page so that each customer as a personal price shown based on a customer attribute (like gender for instance, and of course let it be assigned as new price for the user session) but I can't see a viable option via the magento catalog price rules involving customer attributes other than the assigned group.
I'm using the group to do different kind of discounts and categorization of the customers, so the path of "split the customers on the gender" (or similar) is not an option unfortunately, since I can't assign more than 1 group per customer.
At the moment I was thinking about setting up a custom observer to check for calls to the price generation and then let it consider my customer attributes when calculating the price.
Is that possible? if so, any pointers about?
Would you suggest something different?
Thanks a lot to everyone for your time.
As I was thinking before, I solved my issue creating a custom module with an observer looking for catalog_product_get_final_price calls, getting the customer details from the current customer session.
It works great, I just need to let it display the correct price in the catalog product list, but is minimal, as the price seems to be calculated correctly inside the product page and the cart

how to get id of product in shipping method

Is there anyway to get product Id of product in Shipping module, so that for different category I can charge Additional amount.
for eg: i have to two product in carts. One is in phone category and other is in computer category. for shipment I have to add $5 for phone and $25 for computer . so shipment charge should be $30 dollars in frontend. Is there anyway I can get product Id and corresponding product's category Id in Shipping method collect rates method??
Please help me, I am in a deep trouble....I hope Eg that I provided , explains what I need.
Thanks in advance.
You can get the products from quote
Mage::getSingleton('checkout/cart')->getQuote()->getAllItems();
or
Mage::getSingleton('checkout/type_onepage')->getQuote()->getAllItems();
and iterating over those items (be aware of grouped and bundled parents and so on) will give you the category(s) they might belong to and you can make your conditions against those
This is only a tenable option if products belong to only one category. Unless something has changed in the last couple of versions, there is no data for quote items that shows the category context from which they were added.
WebShopApps.com has several already-developed solutions for shipping scenarios. Depending on development contract & budget, it may be more cost-effective to use one of their well-tested extensions, e.g. Shipping Override Matrix.

Resources