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.
Related
The use case I am working on is such that all products are marked is_in_stock=1 because the items can be purchased regardless of whether they are physically on hand or not. However I need to display only what has a qty value greater than zero. If the user decides they only want to see whats on hand.
I figured out how to select the correct collection by joining the cataloginventory/stock_item table with current collection and filtering for quantity. However I am little in the dark on how to apply this on the frontend and what kinds of side effects this might have since 'qty' is never passed through to solr.
$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*')
->joinField('qty',
'cataloginventory/stock_item',
'qty',
'product_id=entity_id',
'{{table}}.stock_id=1',
'left')
->addAttributeToFilter('qty', array("gt" => 0));
If anyone with experience working with EE layered nav has any input on a better approach to take, advice would be appreciated, thanks.
Unable to post a comment at this time.
Trying to understand your problem statement. Here is what I understand from your statement.
Products can be purchased when they are In Stock and when they are Out Of Stock
Currently, you DO NOT want to display Out Of Stock products in Category and Search Pages. You want to display ONLY In Stock products.
Let me know if my understanding is correct.
If the above is the case, this can be easily achieved from the ADMIN panel.
Navigate to System > Configuration > Catalog > Inventory > Stock Options > Display out of stock products > Yes / No
Set this to Yes, to make the products visible across Category and Search (MySQL/SOLR) pages.
Set this to No, to make the products invisible across Category and Search Pages. However, in this case, Product URL will still work fine.
When using Filtered Navigation, the condition for STOCK is not checked. It checks STATUS and VISIBILITY
The above code block written is fine from performance perspective. Does this mean you are going to use QTY for filtering purpose?
If that's the case and if you are using MySQL/SOLR for Search, the product collection needs to be modified using the code block mentioned above.
This does not impact in a negative way if used as below:
After the final collection is formed using all the necessary attribute filters - default magento, then add your code block.
**Do not instantiate the collection using the code mentioned above.
$collection->joinField('qty',
'cataloginventory/stock_item',
'qty',
'product_id=entity_id',
'{{table}}.stock_id=1',
'left')
->addAttributeToFilter('qty', array("gt" => 0));
I am not really sure if I was able to answer your question. However, these are few basic points about Filtered Navigation, SOLR/MySQL Search, Category and Search Pages w.r.t In Stock/Out of Stock products.
I am looking for solution or extension for my Magento store.
I need a feature that customer could add product with different product type more than one time.
victoriassecret.com has it and it is really cool feature.
It is named "Add More at a Time"
For ex: http://www.victoriassecret.com/panties/5-for-26-styles/thong-panty-allover-lace-from-cotton-lingerie?ProductID=187902&CatalogueType=OLS
I tried to create Grouped, Configurable, Bundle in magento but it doesnt work the same.
Please could somebody to help ? :)
Thank you!
I am suggesting the logic which came in my mind.
I think you need to do customization in product details page. You need to fetch all configurable options like Color size , which will match the sku.
suppose , you have one product called , "thong-panty-allover-lace-from-cotton-lingerie".
If you have three colors , you need to add three products,
thong-panty-allover-lace-from-cotton-lingerie-blue
thong-panty-allover-lace-from-cotton-lingerie-red
thong-panty-allover-lace-from-cotton-lingerie-green
You have to do coding and logically and need to find sku like "thong-panty-allover-lace-from-cotton-lingerie".
Your customized code will be something like this
<?php
if($_REQUEST['CatalogType']=="OLS"){
....
...
$sku = "some value";
fetch sku of product id " 187902 "and fetch other products which SKU is like $sku.
After this , in loop , create HTML and SIZE and Color dropdown of each product.
and on add button , add that product in cart separately.*/
}
?>
Hope this will helpful for you.
I have just shared my thought , how you can proceed further , from my point of view.
I'm on Magento 1.7.0.2. When I view all products within category, I got a blank page after loading for while and sometimes I got Internal Server Error.
Please advise
If it works for only a few products, most probably you are running out of memory. Increase it. The recommended value is 512M, but the more you have the better.
if you used product collection & addAttributeToSelect('*') on it.
or
Mage::getModel('catalog/layer')->prepareProductCollection($collection);
then dont use any one
select the specific attribute which you need.
for example
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect(array('name', 'url_key','price','lowest_price','service_id','description','short_description'));
because loading all attributes of product affects on big database.
and its also affect on site performance
hope this help you
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.
I've gone through and set up an additional store view for our Magento store. The purpose of this view is to allow the display of different currency (for now) with future plans to allow language, content, etc based on store view.
Everything seems pretty normal. When I go to www.example.com/au - I get the standard version of the site with $AU as the currency.
When I navigate to www.example.com/us - The proper currency conversion is happening, showing in $US, but only in the mini-cart and checkout. The category and product view pages are still displaying the $AU value.
Those template files were completed by a different developer, and so I'm assuming they used the wrong function to grab the price of each item. They used:
<?php echo number_format($_product->getPrice(), 2) ?>
I'm thinking I need to toss in the proper function that grabs the price based on store view id, but I'm having difficulty tracking this down.
Any help, of course, and as always, much appreciated.
Update:
I ended up using this, and it works how I wanted:
$this->getPriceHtml($_product, true)
I know this is old but I came across this while looking for an answer the same question.
You can use:
Mage::helper('core')->currency($_product->getPrice())
This formats the price (removes trailing zeros) and converts to the correct currency. Also works if the user changes their currency.
Try
<?php echo $_product->getFormatedPrice(); ?>
it will format price according current store currency rules (see Mage_Directory_Model_Currency::format() for more info).