product prices not updating in configurable products - magento

I am looking at creating a configurable product that has various prices.
Having looked at this, it seems that when you select an option, that has another price, the price field of the product options section does not update.
I have provided an image below:
Image
You can see that I have selected a product option, Oxygen, which is £273. I was expecting the product price of the option to update to match this, but it doesn't.
Under the Associated Products section, I have added a fixed price for the associated products, but this still does not update the price.
I cannot believe that this isn't available out-of-the-box with Magento.
Has anyone ever noticed this before?
I have found This link
Which seems to suggest that it has been noticed before.
Does Simple Configurable Products fix this problem?
Many thanks

SCP will solve your problem - it takes the price from the child product. Unfortunately, this will not work too well if you are also using Custom Product Options with price differentials.
Depending on the complexity of your products you may want to go with normal Magento and a script to work out what the price variants are for the super attribute options. The array for the super attribute price options can be iterated over, master and child products checked against the attribute(s) that change, e.g. colours, and a new attribute array written out. It is a bit of code you will have to write yourself, but here is an article that covers the basics:
http://www.ayasoftware.com/content/magento-update-fly-super-product-attributes-configuration

worse, scp does not allow the customer to edit the choice. My Client insisted he could edit his choice so we had to develop for this using the JSON encoded script on the product view page instead.
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<?php $jason = $this->getJsonConfig(); ?>
<?php $uJason = json_decode($jason); ?>
<?php
if ($_product->getMsrp() > 0) {
$uJason->productMsrp = sprintf("%01.2f", $_product->getMsrp());
}
$jason = json_encode($uJason);
?>
<script type="text/javascript">
var optionsPrice = new Product.OptionsPrice(<?php echo $jason ?>);
</script>
I think we had to change the code elsewhere but the above change allowed the msrp to update as well as the price.

Related

Magento 2: Get Simple Product's Price?

I've been building a Magento 2 template however I've hit a roadblock with the way I'm pulling the prices. The prices are being pulled correctly for simple products by using the following (simplified as I'm exploding the variable to split the string):
$price = $product->getPrice();
<p><?php echo $price; ?></p>
Due to Magento 2 changing the way it processes the prices of configurable products, the price is being outputted as 0.00 for configurables and not pulling the price of the simple products that are attached to it. This was to be expected because I'm not telling it to pull the price of the simple products.
What's the best way for me to get the prices of the simple products? There's a size dropdown on the configurable so ideally, the price would change depending on which product you click on in the dropdown.
Due to me having to explode the price string, I can't just call the block in the XML file either unless I write an overkill jQuery script to split the string on the browser...
Thanks!
Try this code it will help you.
if($product->getTypeId() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE){
$product->getFinalPrice();
}
else
{
echo $product->getPrice();
}
in your block phtml file you can just use
<?php
$_product = $this->getProduct();
echo $_product->getFinalPrice();
?>
it should show you final price,it work with simple and bundle products

How to get bundle product price tax for bundled product?

Ok so I've got the max price for a bundled product using the code below in my list.phtml template, but the tax is not added, could someone shed some light on this please?
<?php
// Get product
$_product = new Mage_Catalog_Model_Product();
$_product->load($product_id);
echo Mage::helper('core')->currency(Mage::helper('tax')->getPrice($_product, $_product->getMaxPrice(), true));
?>
Ideally I would like to get getPriceHtml($_product, true) ?> to display the price but this returns the base price which is zero. Any changes I make to the price.phtml file don't seem to have any effect either, would this suggest there is a plugin which is overriding it?
Which version are you running? There's an old bundled/grouped product defect that you might have hit.
http://www.magentocommerce.com/boards/viewthread/224677/
Products are indexed with no tax so you have to add the tax yourself, but if you change your price.phtml with no effect you either have a cache running or a layer that overrides your class file.

Get magento subtotal from cart

I'm currently using this snippet to show the cart totals in the topcart of my Magento shop. My problem is that it's not always updating when products is put in cart, it's just showing 0$, especially configurable products. But when a second product is put in the cart, it's working again.
Am I missing something, should there be a "check" of some kind before this piece of code?
<?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
You can also try following code it works for me
<?php echo Mage::helper('checkout/cart')->getQuote()->getSubtotal() ?>
Make sure your top cart block is extending a relevant block type such as Mage_Checkout_Block_Cart_Sidebar. If you do, you will have access to useful functionality that will save you rewriting unnecessary code.
For example, if you extend Mage_Checkout_Block_Cart_Sidebar - you can call getSubtotal()
An alternative would be to use the following:
Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
you can use this code:
$subtotals= Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
echo $formattedPrice = Mage::helper('core')->currency($subtotals , true, false);
None of the above worked for me but I was able to get the subtotal using this:
$orderObj = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
$orderSubTotal = $orderObj->getSubtotal();
echo $orderSubTotal;
This refers to the success.phtml page.

Cant retrieve discounted product price in custom script

I have a custom script that outputs a list of particular products in csv format. The frontend of the store just runs fine, however when retrieving the price of a product in my script, the actual FinalPrice does not take my catalog price rules into account, which is kind of messed up, since the getFinalPrice() method works perfectly in template files ect..
This is my code, which I have drastically shortened for demonstration purposes:
<?php
require 'app/Mage.php';
Mage::app('default');
$product = Mage::getModel("catalog/product")->load(27809);
echo $product->getFinalPrice();
?>
This outputs the product's regular price, but not the price accounted for the catalog price rule. I have just applied all catalog rules again and have also rebuilt all indexes. As I said, the discount prices show fine in the frontend, but for some reason I am not able to retrieve them in my script.
I hope someone has an idea what could be going wrong here. Thanks in advance!
Product final price is calculated in an observer, and your script is not loading the events configuration.
See my addition below.
<?php
require 'app/Mage.php';
Mage::app('default');
//load event configuration areas
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND, Mage_Core_Model_App_Area::PART_EVENTS);
$product = Mage::getModel("catalog/product")->load(27809);
echo $product->getFinalPrice();
?>
See Mage_CatalogRule_Model_Observer::processFrontFinalPrice();.

Magento - Not able to display tier pricing in product view

I have a different price set for products based on customer group. I want to show both price's to the customer in case both of them apply in product list, view, related and upsell products.
I turned on template path hints to verify that prices for all views are being rendered from the same template file, which is as follows:
/app/design/frontend/default/my_theme/template/catalog/product
I can see tier pricing correctly in product list, related and upsell products, but NOT for product view.
After debugging for a while I have narrowed down the problematic part of catalog/product/price.phtml file as follows:
<?php
$_coreHelper = $this->helper('core');
$_weeeHelper = $this->helper('weee');
$_taxHelper = $this->helper('tax');
$_product = $this->getProduct();
$_id = $_product->getId();
echo 'Product Id: ' . $_id;
$_weeeSeparator = '';
$_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices());
echo 'Simple Price Tax: ' . $_simplePricesTax;
$_minimalPriceValue = $_product->getMinimalPrice();
echo 'Minimal Price Value: ' . $_minimalPriceValue;
//$_minimalPriceValue = 41;
$_minimalPrice = $_taxHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax);
echo 'Minimal Price: ' . $_minimalPrice;
//$_minimalPrice = 41;
?>
I have echoed all prices fetched from models above, and only in case of product view page the $_product->getMinimalPrice() above does not return anything, while it appears correctly on list, related and upsell products.
I cannot think of any reason for this. There are a few lines different in catalog.xml but I don't think they have anything to do with this. Besides, there are a couple of commented lines in the above code, where I have hard-coded the minimalPrice and minimalPriceValue variables. After doing that the price starts appearing in product view also. The Product id for all views including product view is also appearing correctly, so the product IS loaded at that time.
We are using a custom template, and I see that in default we are not having this problem. I am using Magento 1.4.1.1
Did you say that what you are trying to do works 100% with a stock theme? If so then you really should look at the differences between your custom theme and the default. Also, you might want to look at any changes the developer made in app/code/community and app/code/local that are customizations for the theme. There could be some conflict.
But if you can't find a difference maybe I can give a few hints as to why you might be seeing this behavior. Sometimes the same model (and block) objects have different data in them when you are viewing on the category list page vs the product view page. The reason is that backend queries to the database are different. I did some work with the tiering system before and I remember that when you are looking at the catalog page, the pricing data actually comes from some catalogindex_* tables rather than the catalog_product_entity_* tables. If I remember correctly, there are two tables that it queries, something like catalogindex_price and catalogindex_minimal_price. But then when you are at the product view page the pricing data comes from the standard catalog_product_entity_* and catalog_product_entity_tier_price tables. Anyway, that probably doesn't solve your problem, but it might get you pointed in the right direction. Good luck.

Resources