I want to set a group price by adding a percentage to the cost of a product(s) in my store.

Is there a way to do this without adding an extension?

How can I achieve this programmatically?

SR_Magento EDIT:

The answer to this questions appears to lie in the table catalog_product_entity_group_price

By manually creating a group price for a product, I was able to create additional group prices based on the original example: enter image description here

It stands to reason that it is possible to do this programmatically by creating a markup cost + x% and then populate the field "value". The entity_id is the products Magento ID, the customer_group_id is the ID of the Group you wish to give special pricing.

Bounty expires in 2 days, if I don't get at least an SQL statement I can work with I will let it expire.

  • Can I assume you want your selling price to be some percentage more than your cost ? – Prateek Oct 9 '15 at 6:24
  • Yes. I am using this for selling store to store. I have other retailers that buy from me and they get a cost plus 10% price. – John Oct 9 '15 at 16:04
  • Any luck?, I'm looking for the same thing! – SR_Magento Oct 22 '15 at 15:46

This solution requires you know a little SQL to accomplish what you want, but I think it's along the lines of what SR_Magento is thinking.

In this example, I assume you have one website so I default website_id and all_groups to 0, I use 2 as the customer_group but feel free to update this to your customer group id that you are using.

I set the group price to cost plus 10%. You can change the percentage by update (value/10) and setting 10 to your new percentage.

Attribute_id of 100 in the catalog_product_entity_decimal table should be your product costs. This is all one mysql query, tested and working on my dev site prior to formatting it here:

INSERT INTO catalog_product_entity_group_price(
    all_groups, website_id)    

  SELECT entity_id, 
     value + (value/10) as value, 
     2 as customer_group_id, 
     0 as all_groups, 
     0 as website_id

  FROM catalog_product_entity_decimal 

  WHERE entity_type_id=10 
     AND attribute_id=100 
     AND value IS NOT NULL
  • This is exactly what I was looking for, thank you! – SR_Magento Oct 28 '15 at 11:27

If you install http://www.magentocommerce.com/magento-connect/magento-debug.html you can see the query that Magento runs when you manually set the price. That will give you the SQL code you want.

  • That looks like a nifty tool, wasnt aware of it thanks for sharing it! – SR_Magento Oct 28 '15 at 11:28

To A) No, you cannot. And extension is, what you need.

B) You can achieve this programatically (with an extension).First thing I found on google is this one. The description reads as if would do the job:


Bb) you have to be more clear about how you want to define cost+x = price. Is that for ALL Articles? For a Category? For a certain Attribute Type?

Leading to C) get the extension. If it's insufficent, extend the extension. It'll be much less hussle the building you own extension.

  • And yes, you could write that your own and no, you cannot do that below the price of the module. – Bernhard Prange Oct 26 '15 at 9:03
  • What is this Google you speak of? Please read the Bounty Need a solution to create group pricing programmatically for all products – SR_Magento Oct 26 '15 at 11:32
  • I edited the answer. – Bernhard Prange Oct 26 '15 at 12:14
  • This is definitely achievable without a module. – SR_Magento Oct 26 '15 at 16:34
  • Sure @SR_Magento, you could to something like a setPrice on save event if product exitsts. Techically this would be also ok with just extending locally. But will you be lucky with that? A fixed raise over all products? – Bernhard Prange Oct 26 '15 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.