By default Magento provides a Newsletter feature, which enables store
administrators to send newsletters to customers who have registered to receive
them. Since most customers tend not to opt-in to any email subscription related
services, you might need to automatically subscribe customers when they
register or place an order. In this article I’ll present code and simple
Magento extension to make it easier for you to accomplish this task.
How to Add a ‘New Product’ Icon in Magento for New Products
1. Manage attributes
Go to Catalogue -> Attributes
-> Manage Attributes. Set up a new attribute at this page and call it
‘Boolean’. Set its ID as new_product. Under your advanced options, you will
have the option to select it as a front end product. Do this. Now you simply
have to add the new attribute to your custom attribute if you are using one. If
not, set it to default. Save the new product.
You will now have a new product in
your catalogue which has a Boolean flag set to yes. The next stage involves
taking this new product icon and putting it in your front end.
2.
Make it show
Now that you have a product icon
with a Boolean flag, it’s time to make this show on your front end. This is
achieved by accessing template files: templates/catalog/product/list.phtml and
templates/catalog/product/view/media.phtml.
<div
class="product-image">
<?php
if($_product->getNewProduct()) { ?>
<div
class="new-product"></div>
<?php } ?>
<?php
$_img = '<img
id="image" src="'.$this->helper('catalog/image')
->init($_product,
'image').'"
alt="'.$this->htmlEscape($this->getImageLabel()).'"
title="'.$this->htmlEscape($this->getImageLabel()).'"
/>';
echo
$_helper->productAttribute($_product, $_img, 'image');
?>
</div>
As you can see, above, your new
product is shows in ‘$_product->getNewProduct’. The next step is to ensure
that your CSS is set up to show your product with Boolean flag. You need to
make the product_class relative to the position of the icon. So:
.products-grid .product-image {
position: relative; display:block; width:244px; height:156px; margin:0 0 10px;
}
.new-product {
position: absolute;
right: 0;
top: 0;
width: 65px;
height: 66px;
display: block;
z-index: 2;
background: url(../images/new-product.png)
no-repeat;
3.
Save
Save your changes and ensure that
your code is correct before doing so. Now, every time you add a new product and
it goes on sale through your front end, it’ll have an icon and Boolean flag.
Labels:
Magento
Magento - Can't login to admin in localhost
I am currently working on magento version 1.3.2.4. When i login to admin, it
looks like i have entered proper username and password because it doesn't show
any error like "Invalid username or password". When i try with fake
login I do get error. Even i am not getting any error it stays on the login
page.
So, I had to go through code and comment out few lines after which I was
able to login and access admin again.app\code\core\Mage\Core\Model\Session\Abstract\Varien.php line 77: original:
// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);
Commented out three lines:
// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath() /*,
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()*/
);
Labels:
Magento
Hide "Showing posts with label" message in blogger
- First go to Template > Edit HTML
- In Blogger default templates, search for
<body>
and in custom templates, search for<body>
- Add the below code just after above code.
<b:if cond='data:blog.pageType == "index"'> <b:if cond='data:blog.searchLabel'> <style> .status-msg-wrap{display:none;} </style> </b:if> </b:if>Now Save the template and check the result by clicking any of your labels
How to call an attributes on product page in Magento
Create a new attribute or find a existing attribute to call
on product page.
Step 1:- First of all go to
catalog->attributes->manage attributes on this page you will see a list
of attributes under attribute code you
will see all the attribute code copy any code. For example “cost” to display it on front end on
product view page.
Step 2:- Open \template\catalog\product\view.phtml
now find this code line.
“<?php
$_product = $this->getProduct(); ?>”
After this code we call our attribute by this code.
<?php
If($_product->getCost
()):
echo
$_product->getCost ()
endif;
?>
That’s it.
Labels:
Magento
Subscribe to:
Posts (Atom)