Is there a way to hide the Shopping Cart on Top Menu when it's empty? I believe it is on Links.php file but I don't know what code to add. Also, "Links.php" is a Core file, I am thinking on creating a new module on Local for it. Would it work? Thanks.
Hide the shopping cart side bar when it is empty:
1. Open: app/design/frontend/default/<your template>/template/checkout/cart/sidebar.phtml
2. Go to line 32 Look for
<div class="box base-mini mini-cart">
3. Add these lines right before that opening div tag
<?php $_cartQty = $this->getSummaryCount() ?>
<?php if ($_cartQty >0): ?>
4.Add this line to the bottom of the file
The shopping cart will only show if user adds items to their shopping cart.
Or use these plugin... it's a free plugin for hiding when it is
empty..
Xogenics Hide Cart for Magneto
For hiding in header menu use this
Remove My Cart and Checkout links from the header menu.The code for
these links is located in the checkout.xml file:
In Magento, on your ecommerce site may be you do not want to show MyCart or Checkout links.Follow the steps below to remove the link.
1. Copy the file checkout.xml from app/design/frontend/base/default/layout to app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout or app/design/frontend/default/YOUR_THEME/layout
2. Edit the checkout.xml copied to the app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout folder or app/design/frontend/default/YOUR_THEME/layout folder
3. Look for the following Code snippet
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
4. Comment the following Lines
4.1 Comment the following Line to Remove My Cart Link from header
<!--<action method="addCartLink"></action>-->
4.2 Comment the following Line to Remove Checkout Link from header
<!--<action method="addCheckoutLink"></action>-->
5. Refresh the Magento Cache and Website Page to see the changes
$(document).ready(function(){
$(".top-car").hide();
});
First check if there's quantity in the cart ofcourse with something like:
$qty = $this->helper('checkout/cart')->getSummaryCount()
Hope this helps you
Related
For my magento2 store I want to have a subtitle right beneath the Title the product.
Right now I have it working for the "product overview" with the next code:
I added this code to: catalog_product_view.xml
<referenceBlock name="category.product.addto">
<block class="" name="category.subtitle" template="product/view/subtitle.phtml" />
</referenceBlock>
I created a new subtitle.phtml with the next code in it:
<h3><?php /* #escapeNotVerified */ echo $block->getProduct()->getResource()->getAttribute('subtitle1')->getFrontend()->getValue($block->getProduct()); ?></h3>
But i do not know how to get it working in the category list.
Is there someone who can help me with it?
UPDATE:
the attribute i created has the right settings (used in product listing is enabled)
the code i am using is:
<referenceBlock name="product-item-details"> <block class="Magento\Framework\View\Element\Template" name="category.subtitle" template="product/view/subtitle.phtml" /> </referenceBlock>
i placed this code in "catalog_product_view.xml
Im notting getting the subtitle right beneath my title in the grid view / category view.
i think there must be something wrong with the code from the reference block but i cannot figure out where the problem is .
thanks! regards Mark
How is your attribute setuped. Check the attributes settings because attributes can be hidden.
Your code should work with following:
Make sure “Visible on Product View Page on Front-end” and “Used in Product Listing” options under storefront Properties are set to Yes.
This is a quick guess because your code should work, so please check your settings of custom attribute. If it still doesn't show up can you please provide more details
I'm fairly new to magento, using CE 1.9.
I know how to remove / add tabs on the product page via local.xml
However I'm trying to hide/show a tab based on the value of an attribute of the product.
I have created a custom tab successfully. Additionally the customTab.phtml file I created I was able to get an if statement to work successfully... sort of...
Here is my code inside the phtml file:
<?php
$staticBlockId = 'block_product_tab2';
$product = Mage::registry('current_product'); ?>
<?php if($product->getRepairservice()): ?>
<div class="std"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId($staticBlockId)->toHtml(); ?></div>
<?php endif; ?>
This will successfully hide or show "content" of the tab based on the boolean value of the attribute. However it still is showing the tab, it's just empty.
So I'm thinking I need to go to where it's created in local.xml but I'm not sure how to structure the if statement or get access to the attribute. Any help would be appreciated.
I think the most clear way of doing this is by creating your own layout handle, see: http://inchoo.net/magento/custom-layout-update-handles/. There you've to check if you're on a product page and then check your getRepairservice(), for example:
// Inside the controllerActionLayoutLoadBefore() function of Inchoo's example
$layout = $observer->getEvent()->getLayout();
$product = Mage::registry('current_product');
if($product && $product->getRepairservice())
{
$layout->getUpdate()->addHandle('REPAIR_SERVICE')
}
After that you can add your tab nicely with XML.
<REPAIR_SERVICE>
<reference name="product.info">
<block type="catalog/product_view_description" name="product.new.tab" as="new.tab" template="catalog/product/view/mynewcustomtab.phtml">
<action method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle" translate="value"><value>Custom Tab</value></action>
</block>
</reference>
</REPAIR_SERVICE>
The thing is that I have logo displayed on only homepage in Magento checking if it's homepage with getIsHomepage();. Now the thing I want to do is to display logo inside header only on Dashboard page, do you know any alternative to getIsHomepage but to check if it's My account page?
Thanks
It's best practice to use xml to do this instead of parsing url. Add this to your local.xml:
<customer_account_index>
<reference name="header">
<action method="setTemplate"><template>page/html/customer_account_header.phtml</template></action>
</reference>
</customer_account_index>
And copy and edit your header.phtml file to template/page/html/customer_account_header.phtml
If you want to out logic for customer account page then
First fetch current routers and controllers and action to headere.phtml
logic is like
for magento customer dasboard page url is customer/account/index
then
<?php $action = Mage::app()->getFrontController()->getAction();
echo $action->getFullActionName('_');
if($action->getFullActionName('_')=="customer_account_index")
{
}
?>
I have created custom module which added link in Left navigation menu of My Account Page. Every things is handle By modules Layout.xml.
But My Module link is appeared at Last in position i.e after News letter Subscription. I want to add this after "My Order" Menu.
How can I do this. Please help me.
Thanks
Pravin
In the XML file you can set your block to come before or after another block.
In the layout XML file add the following attribute to the block:
before="name_of_block"
Or:
after="name_of_block"
So your line would look something like this:
<block type="some/type" before="some_other_block_name" template="some/path/to/template.phtml" />
If you want it to come before any other block (or after every other block) use the following:
before="-"
Or:
after="-"
I am looking to track down the file (and it's location) that generates the "Proceed to Checkout" button in the Magento cart.
Try adding a product to the cart, and then proceeding to the cart. The "Proceed to Checkout" button is on the right hand side of the cart.
I am using a hacked-about variation of the blank theme, if that makes any difference.
Thanks in advance for your help.
The code that produces the Proceed to Checkout link is in templates/checkout/onepage/link.phtml
By default the block for it is in checkout.xml;
<block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
<label>Payment Methods After Checkout Button</label>
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
<block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
</block>
app/design/frontend/your_package/your_theme/template/checkout/onepage/link.phtml
The "Proceed to Checkout" button that leads to the onepage checkout, is generated with this template : checkout/onepage/link.phtml.
You should be able to know what buttons are added with which templates by looking at the checkout_cart_index handle of the checkout.xml layout file. The block named checkout.cart.methods contains all the buttons, and the two base checkout buttons should be added to it directly in the same file.
Go to System -> Configuration -> Developer change a Current Configuration Scope to some of your websites or stores than go to Debug section - and change Template Path Hints setting to "Yes". Now, on frontend, you'll see an full path to your template file on a filesystem for every block that rendered, so now you can see where your template (that renders a link) exists.
Open this path in your root directory
/app/design/frontend/base/default/template/checkout/onepage/link.phtml
find this code
<?php if ($this->isPossibleOnepageCheckout()):?>
<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($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?>