开发者

Change price of product on store's website (Magento) [closed]

开发者 https://www.devze.com 2023-01-09 07:29 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 9 years ago.

Is there a way(by codehack if neccesary) to change the price of a product per store website, so from display in search results and individual product view all the way to checkout and order information

I need this for a multishop website where some shops can offer a product at lower price depending on how much they paid and there's an extra percentage added depending on various options.

I've been looking around in app/code/core/catalog but can't seem to find it?

Also, I want to add some custom code to selectio开发者_运维百科n of wich products are displayed in a store(again according to some own data), these 2 are majorly important.

Is it possible?


AND FINALLY! I got this working!

Notice, that you can set different prices for WEBSITE SCOPE only. So just add some websites. For example i need to set different price per country. So i added a few websites with one store and one view.

In index php (replace last lines):

if (isset($_POST['country_id'])){
    $store_id = $_POST['country_id'];
    setcookie('country_id',$store_id);
    Mage::run($store_id,'website');
} else if(isset($_COOKIE['country_id'])) {
    $store_id = $_COOKIE['country_id'];
    Mage::run($store_id,'store');
} else {
    /* Store or website code */
    $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
    /* Run store or run website */
    $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
    Mage::run($mageRunCode, $mageRunType);
}


Code Descriprion:
I pass through the form parameter country_id (actually it is "store id"). Then if found this POST param - remember it with cookie setting. Else if cookie was set earlier - apply store id. Finally, when nothing were set - display default Store.

Step-By-Step guide:

  1. Add Website (and Store+View) for each country I want different price to set up
  2. Set CMS pages from one Store view to "All..."
  3. Set all product Website attribute to all stores
  4. Add design change for all Websites for my current theme (it was custom)
  5. Add some code in index.php
  6. ...
  7. Profit!


To complete Joe's answer, you can set your price scope (Global or per Website) in

System > Configuration > Catalog > Price

If you want to set different prices but on a store view scope, one way is to create customer groups and use tier prices.


If you just want to change the price of a product for each store, that much is simple. The price attribute can be declared to have any scope in the site's configuration, so you can set it to store level and give the product multiple prices.

If, however, you want to change the price of the product programmatically, you are going to have some troubles. On every page load, Magento reloads the shopping cart and makes sure that the prices that were offered are still current. As such, if you have overridden the product price in code, it will overwrite your changes and restore the original product price. You can jump through some hoops and mostly hack this behavior, but it's not really a perfect proposition. Additionally, when the customer goes to reorder (w/ the reorder button), the price will not match either.

For your second question, can you clarify exactly what you are trying to do? It's not really clear what you want.

Hope that helps!

Thanks, Joe

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号