In cart page we can see the discount row only if a customer add a coupon code(?). What I want to do is adding the discount as zero for every cart page even there is not any coupon code applied.
What I see:
Total (Inc VAT) £42.00
Subtotal (net) £35.00
Subtotal (Inc VAT) £42.00
VAT £7.00
What I want:
Discount £0.00
Total (Inc VAT) £42.00
Subtotal (net) £35.00
Subtotal (Inc VAT) £42.00
VAT £7.00
This is my design/.../template/checkout/total/default.phtml file for viewing discount with coupon code:
<tr>
<td colspan="<?php echo $this->getColspan(); ?>" style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->escapeHtml($this->getTotal()->getTitle()); ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</td>
<td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</td>
The problem I'm having is whenever cart page is loaded, this block won't load, unless there is coupon code applied, obviously. What I want to know is that is there any flag or controller for make the block appear even no coupon is applied so in above block I can check whether coupon is applied or not to customize the above view. Can you give me any suggestions?
PS: here coupons means shopping cart price rules.
Related
We're running Magento 1.9.2.4
There are several simple products making up a few configurable products which we are wanting customers to be able to order if they are in stock or out of stock.
We're running custom themes and plugins, i've reverted back to RWD to ensure there are no template mistakes and disabled all of the plugins.
All options have been set globally, i've double checked the both the simple and configurable products to ensure that they are set with product levels and are in stock where applicable.
Cache has been cleared and all data has been re-indexed.
I've attached a screen shot of the settings.
https://www.dropbox.com/s/x96aqhh2h9b86ik/Screenshot%202017-02-14%2018.59.54.png?dl=0
I've read lots of threads and there appears to be a few people that have had this issue on different versions of Magento but none of the fixes appear to have worked.
I found the issue, the availability.phtm file needed updating to pull in another status.
There was an article I found online which helped, its not 100% right for 1.9.2.4 but got me most of the way there.
<?php $_product = $this->getProduct() ?>
<?php echo $this->getPriceHtml($_product) ?>
<?php $stockLevel = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty(); ?>
<?php if($_product->isSaleable()<strong> && $stockLevel > 0</strong>): ?>
<p class="availability in-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('In stock') ?></span></p>
<?php elseif($_product->isSaleable() && $stockLevel <= 0): ?>
<p class="availability in-stock">
<?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Available for Backorder') ?></span><br />
<?php echo $this->__('Please allow up to two weeks for delivery') ?>
</p>
<?php else: ?>
<p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
https://edmondscommerce.github.io/magento/ssssssssssssss.html
I want to hide proceed checkout button until cart price is less then 100 and customer group is "retailer" and if price greater then 100 and customer group is "Retailer" then proceed checkout button show. How to achieve this functionality ? Help Me.
In your theme, edit the template file
checkout/onepage/link.phtml
there is code
<?php if ($this->isPossibleOnepageCheckout()):?>
<button type="button" title="<?php echo $this->__('Proceed to Checkout') ?>" class="button btn-proceed-checkout btn-checkout<?php if ($this->isDisabled()):?> no-checkout<?php endif; ?>"<?php if ($this->isDisabled()):?> disabled="disabled"<?php endif; ?> onclick="window.location='<?php echo $this->getCheckoutUrl() ?>';"><span><span><?php echo $this->__('Proceed to Checkout') ?></span></span></button>
<?php endif?>
You will find this function isPossibleOnepageCheckout() in
Mage/Checkout/Block/Onepage/Link.php
You can extend this class and add your custom logic by which you can hide the checkout button.
Also in /Mage/Checkout/controllers/OnepageController.php
in indexAction()
write your condition so that user is redirected to cart page if condition is not fulfilled
I am trying to figure out how to hide the regular price on a product page only if tiered pricing exists for the product. Any tips would be gratefully appreciated.
I have been working on the following code to conditionally display price if tiered pricing but just cannot get it to work.
<?php if (count($_tierPrices) == 0): ?>
<?php echo $this->getPriceHtml($_product) ?>
<?php endif; ?>
Tier price is something that is added when a certain quantity of product is selected. So for default product there should not be any tier price. When certain product is selected tier price is added
There is a block which displays tier price if there is any tier price present
Wrap the code with a conditional statement in catalog/product/view/type/default.phtml:
<?php if (count($_tierPrices) == 0): ?>
<?php echo $this->getPriceHtml($_product) ?>
<?php endif; ?>
Add a conditional statement in catalog/product/view/type/default.phtml
<?php if (count($this->getTierPrices()) == 0): ?>
<?php echo $this->getPriceHtml($_product) ?>
<?php endif;?>
I have a magento 1.7.0.2 install. I created a shopping price cart rule with coupon. Everything is fine except that the discount amount displayed in magento (cart, checkout,...) is an extremal value. I found out that extremal value is 2^64 (18 446 744 073 709 550 520). The configuration of the rule does not matter, the displayed discount is 2^64 always.
The subtotal is fine, the shipping is fine the sum of these is 11669. after applying the discount(10%) on the subtotal(10961) the result is 9864. 9864+708=10573 is an acceptable result. So Everything is perfect except the displayed discount.
I don't know where does it go wrong. I can't find the related file. Please help.
Thanks a lot,
István
After all I found the solution. The cause of this error is simple. The discount amount stored by magento is signed, that means it has a negative sign. The file app/design/frontend/[yourfrontend]/[yourtheme]/template/checkout/total/default.phtml ( this is where the amount is written on screen) contains the following code:
<tr>
<th colspan="<?php echo $this->getColspan(); ?>" style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->escapeHtml($this->getTotal()->getTitle()); ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</th>
<td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
</td>
The problem is the formatPrice() function, and the negative parameter. A simple solution is the abs() php function. Change the line
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
to
<?php echo $this->helper('checkout')->formatPrice(abs($this->getTotal()->getValue())) ?>
And here we go, the problem solved.
I hope that helps.
I've managed to add options to configurable products on my catalog pages using the code found here: http://www.magentocommerce.com/boards/viewthread/21039/P45/#t167724. What I'd like to do now is only show the options that are available according to the stock of the simple product that the option is coming from.
For example, if I have a t-shirt (configurable product) that has various colors (simple products) and my red color is out of stock, red wouldn't be shown as an option when the configurable product is displayed.
What's the best way to do this?
Update:
For the sake of clarity, here is the relevant block of code from the link I posted.
<?php if($product->getTypeId() == "configurable"): ?>
<?php $attValConfig = $product->getTypeInstance()->getConfigurableAttributesAsArray(); ?>
<?php if(sizeof($attValConfig)): ?>
<?php foreach($attValConfig as $attValConfigSingle): ?>
<fieldset class="product-options" id="product-options-wrapper">
<label><?php echo $attValConfigSingle['label']; ?>:</label>
<select name="super_attribute[<?php echo $attValConfigSingle['attribute_id'] ?>]" id="attribute<?php echo $_product->getId() ?>" class="required-entry super-attribute-select">
<?php foreach($attValConfigSingle['values'] as $attValConfigSingleVal): ?>
<option value="<?php echo $attValConfigSingleVal['value_index'] ?>"><?php echo $attValConfigSingleVal['label'] ?></option>
<?php endforeach; ?>
</select>
</fieldset>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
Since this code is simply getting all of the configurable options and displaying them, it doesn't check to see if the simple product that backs the configurable option is in stock. How do I do this?
I just wondering why we are checking the quantity for stock status why dont't we look on stock availability of simple products.
I have achieved to show out of stock on configurable product according to stock status.
Now you can make product "out stock" and "in stock" through stock availability attribute of simple product.
Try the following ( do what you want returning result ) :
$_productCollection = Mage::getModel('cataloginventory/stock_item')->getCollection()
->addIdFilter($productId) // this line is wrong, don't care this
->addFieldToFilter('qty', array('gteq' => 1));