Odoo - Currency sign not displaying in the qWeb - odoo-9

I have got a custom report and the currency sign is not displayed.
What could be wrong in this:
<span t-esc="grand_total" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>

You should use currency from invoice object. Change t-esc to t-field. What can you see when you just add t-field="grand_total" ?
<span t-field="grand_total" t-options="{'widget': 'monetary', 'display_currency': o.currency_id}"/>

Related

Odoo - Python Programming Language

Employee Birthday List in QWeb Report :
Actually generate Qweb report employees birthday list.
But print button is one model and fetch the report is one model.
How to access the employee details in qweb report ?
in you model from where the print button is
#api.multi
def qweb_callmethod()
return SomeValue
in Qweb report
<span t-esc ="o.qweb_callmethod()" />

How to change price format in Magento 1

I am getting stuck over 1 days to find how to change price format in Magento.
My current store displaying the price format like (US$1.114,50) but I need the correct format is (US$1,114.50).
So, everyone here know how to change this format?
Thank you so much for your kindly help.
Formatting price in Magento
There are a couple of methods to format price in Magento. The easiest and most used is:
Mage::helper("core")->currency($price, $format, $includeContainer)
Example:
echo Mage::helper("core")->currency(115, true, false)
//if your currency is Euro then output will be: €115.00
Sometimes you don’t need currency symbols in your prices, then you will need something like:
Mage::getModel('directory/currency')->setData("currency_code", Mage::app()->getStore(null)->getCurrentCurrency()->getCode())->format(
$product->getFinalPrice(),
array('display' =>Zend_Currency::NO_SYMBOL), false);
The value for the display can be Zend_Currency::NO_SYMBOL (it will remove the symbol and show only the price) Zend_Currency::USE_SYMBOL (shows the currency symbol before the price), Zend_Currency::USE_SHORTNAME (shows the abbreviation of the currency before the price) or Zend_Currency::USE_NAME (shows the full name of the currency before the price). Example outputs:
Zend_Currency::NO_SYMBOL: 115.00
Zend_Currency::USE_SYMBOL: €115.00
Zend_Currency::USE_SHORTNAME: EUR115.00
Zend_Currency::USE_NAME: EURO115.00

Magento - Add attribute if the product qty is zero

I want to insert this attrribute that I have created into the product page above the add to cart button but only if the qty is ZERO. Basically an estimated arrival date. Items that are available on back order only have a note above the add to cart button of when the product will actually be available from. I have put the below in and it works but I don't want it to show for products already available.
<p><font color="red">AVAILABLE FROM: <?php echo $_product->getResource()->getAttribute('due_date')->getFrontend()->getValue($_product); ?></font></p>
Can someone let me know what I need to add please.
Most appreciated
Anthony
You should be able to get the stock quantity on the product page by using:
Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()
You can then use that in a conditional to show the piece of code that you want. However, I'm not sure you need all of that to show the due date. Because you're already loading the product when you are on the product page, you should just be able to use:
<p class="red">AVAILABLE FROM: <?php echo $_product->getDueDate(); ?></p>
If that doesn't work, make sure that you have your due date attribute set to be visible on the product page. It'll be the one called, "Visible on Product View Page on Front-end".
Full code block could look something like this:
<?php
$qty = Mage::getModel(cataloginventory/stock_item)->loadByProduct($_product)->getQty();
if ($qty <= 0): ?>
<p class="red">AVAILABLE FROM: <?php echo $_product->getDueDate(); ?></p>
<?php endif; ?>
If you allow backorders, it's important you check for <= 0, rather than == 0. This is because if someone backorders it, your stock will go negative.
Also, it's more clean to remove the font tag and use CSS to style the text.

Prestashop Cart Summary : Custom code is disabled when quantities added

I modified the shopping-cart-product-line.tpl, so that it displays the product price with and without tax in the cart summary.
With Tax : price=$product.price_wt
Without Tax : price=$product.price
<li class="price priceDark{if isset($product.is_discounted) && $product.is_discounted && isset($product.reduction_applies) && $product.reduction_applies} special-price{/if}">{convertPrice price=$product.price_wt} TTC</li>
<li class="price{if isset($product.is_discounted) && $product.is_discounted && isset($product.reduction_applies) && $product.reduction_applies} {/if}">{convertPrice price=$product.price} HT</li>
It's working fine, but the line without tax disappears when I change the quantity.
So do the "TTC" and "HT" legends.
Might be that my comments are not included in some other file but I'm a bit lost.
You should look at your_theme/js/cart-summary.js file. And I think you should edit updateCartSummary function. Its place where your summary is updating. Other thing: addd new or with different class. It should`nt remove unit price wihout VAT, but also it always stay same price. So you must add line to count sum: price_tax_excl * quantity.
So briefly, you must edit or extend your cart-sumarry.js file.

Magento display a 3rd price on the product page

I would like to add a third price to my products like "MSRP" on the latest version but not available on mine (Magento 1.4.1.1).
I would like to display it on the product page and it has to change according to the selected option.
So, I started by creating a new attribute called "msrp".
I managed to get it for every child product on my view.phtml file with the following code:
<?php
if($_product->isConfigurable())
{
$_associatedProducts = $_product->getTypeInstance()->getUsedProducts();
foreach($_associatedProducts as $assProducts)
{
$msrp = $assProducts->getData("msrp");
echo "MSRP: ".$msrp."<br />" ;
}
}
?>
Now the question is how to show it only one at a time and which corresponds to the selected option?
(Just like the normal price changes when we select an option.)
Maybe with a piece of javascript in this file?
/app/design/frontend/[...]/[...]/template/catalog/product/view/type/options/configurable.phtml
Thanks for your help !

Resources