Magento custom Product Attribute - magento

I add an attribute type Yes/No is_special to product.
(I want to just logged user can see special products.)
Then, I open some products and set to Yes But when I show it on front end, All is No.
I clear cache and reindex before. But It still No
Please help me guys. I am very grateful to You...!!
Thanks In Advance...!!

When attributes are added, they are added to the database and magento caches the calls to certain databases. Try deleting your cache folder in var/cache and see if that helps.

When you create a new product attribute, you have a lot of options, a few changing the loading bahavious "Show in product listing" sets the collection to load this on the category pages, "Visible on Product View Page on Front-end" loads the attribute on the product view page.

First you need to add featured/special product attribute to magento. Please refer my tutorial which explains how to add yes/no attribute.
http://www.pearlbells.co.uk/adding-custom-product-attributes-in-magento/
Then you filter the featured products using the code in phtml.
<?php
$featuredProducts = Mage::getModel('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('featured_product', 1)
->addAttributeToFilter('status', 1);
?>

Related

View all products within category lead to blank page

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

User message not showing in product view page

In one of the Magento store, I have to restrict customers to add a product more the one time.
I checked with the cart and pass an error to the customer. But Magento does not show any message in product view page.
Mage::getSingleton('core/session')->addNotice('You have already added this product in your cart');
Check the above code, I placed it in controller file. I thought it was correct. Let me know what I missed.
I'll add an explanation later, try this:
Mage::getSingleton('catalog/session')->addNotice('You have already added this product in your cart');

Magento - Some products not for sale

I would like to set some products to "non-saleable", removing the "Add to cart" button and adding a link to contact form.
I'm looking for this solution for a few weeks. Searching, I found this post:
Magento - product that are not for sale
At the end of page have this answer:
""Alternatively, you could set up a new product attribute that replaces the add to cart button with something different (more info button, popup, etc)."
How can I do it?
Another post about this subject:
http://www.e-commercewebdesign.co.uk/blog/magento-tutorials/non-salable-products-with-attribute-sets.php
But I can't make it work. Someone could help me with more details?
small tutorial
Create a new attribute "saleable"
Default Value = yes
Unique value = no
values required = yes
apply to = all product types
use in quick search = no
use in advanced searched = no
comparable on front-end = no
Use In Layered Navigation = no
Use for Promo Rule Conditions = no
Visible on Product View Page on Front-end = no
Used in Product Listing = no
Used for Sorting in Product Listing = no
Manage titles
admin = "Is saleable"
Default store view = "Is saleable"
Now add it to your attribute set (default)
create a product or edit a product and define the is "is saleable" attribute.
Now go to the view of your product
/tomcollins.be/app/design/frontend/default//template/catalog/product/view.phtml
put an if statement like this
<? if($_product->getData('saleable')): ?>
// do what ever you want
<?php else: ?>
// do what ever you want
<?php endif; ?>
Hope this helps someone :)
bye
Modify your product with an Attribute for example nonsaleable. If that Attribute has value true the product is not saleable.
So now you should take a look at the
Productview in app/design/frontend/your_theme/your_theme/template/catalog/product/view.phtml
and the
listview app/design/frontend/your_theme/your_theme/template/catalog/product/list.phtml
Now look where in these files are the addtocart buttons are located.
Before this button you place an if nonsable === TRUE { make something } else { addtocart }
Thats the way i would try this.
Sorry for my bad english. I'm still tired :))))
For all non-for sale products you can set a quantity to 0. It will automatically remove Add to cart. Then you can add link to contact form on all products where add-to-cart doesn't exist. I am coming from Magento Go background so I would do it this way, but I know that with community and enterprise versions you have more flexibility.
I guess you will get your desire requirement through this extension because the developer teams for this extension is really very supportive.Please refer below link for extension:
Click here to get extension

Filter one specific attribute values from products in magento

I'm new in magento, I'm working on http://www.theartworkgallery24.com/stage/ website. Please check beneath flash banner, there are 4 big images that are links to attributes value from which user can directly go to a product.
I need a page that display on one specific attribute values like in case of artist, it should be Gustav Klimt, Leonardo Da Vinci etc. These should be links to actual product related to the attribute values.
Please tell me how to make your own PHTML or PHP file, which code to use and how, and in last how to call your code in your magento website.
Any ideas will be appreciated, thanks.
You please create an attribute (davinchi) in admin side for these functionality. You can create products attributes from catalog->attributes->menu.After that you can see these attribute value in product creation page.You just assign it to different products
After that you can either create a module for this. Otherwise just create a phtml file in catalog/product/ folder.
then enter the below custom collection code in it.
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('*');
//filter codition
$collection->addFieldToFilter(array(
array('attribute'=>'davinchi','eq'=>1),
));
This will load products having attribute value davinchi=1.

Why are my related products not displaying on my product page?

I have gone to admin -> manage product -> product information page -> related products
Then I added a product that is related, and saved.
I went to that product and refreshed the page, but nothing changed. Why not?
Also, be sure to check that the product you're trying to see in 'Related Products' is not already in your cart. Magento has a default filter applied that removes items in the cart from the related products collection.
Solution:
Login to Admin
Go to System -> Index Management
Select All checkboxes
Select 'Reindex Data' from Actions selection list
Click Submit button
Reference: Magento Up-sells Cross-sells and Related products are not showing up
Related Products appear in product info page, in the right column.
Cross Sell items appear in the shopping cart.
Upsells for this product are items that your customers would ideally buy instead of the product they’re viewing.These appear on the product info page underneath the product description.
As a result, I understand that you would show products bottom of the product info page, you should choose upsells instead of related products.
If you want related products ( which I can misunderstanding you ) do following things :
Check related product status is enabled.
Check visibility status set "Catalog" or "Catalog Search"
If everything is fine, check the inventory of related products.Stock should be greater than 0.
Last thing, related products must be include a category. Click "categories" link to check and see if the product added in a category.
Click on the "Reset Filter" button on top of the related product listing. It will list all products in table. Or you can clear cache + reindex data.
I had the same issue. After some time ago, I found that the products are not made to be visible in the visibility section, and that the products are not set to be in any website.
Hope this is the answer, and should be, because if you set up everything right there is nothing that can make problems.
Make sure the product and related product are under the same website. This isn't apparent when adding the relating products.
One possible pitfall you can run into is that you use a template without a right column. In that case you have to use unsetChild and insert to move the related product block.

Resources