Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
How do I add or remove manufacturers? 
 
boomography
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-04-15
Madeira Beach, FL
 

I need to add manufacturers on the fly… Here is how I solved it…

function validateManufacturer($manu)
    
{
        $sql 
"select option_id from eav_attribute_option_value where value = '".$manu."'";
        
$data Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($sql);

        if(
count($data)==0{
            $connection 
Mage::getSingleton('core/resource')->getConnection('core_write');
            
$connection->query("insert into eav_attribute_option (attribute_id) values (66)");
            
$connection->query("insert into eav_attribute_option_value (option_id,value) values ((select max(option_id) from eav_attribute_option),'".$manu."')");
            
$data Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($sql);
                
        
}
        $option_id 
$data[0]['option_id'];
        return 
$option_id;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
bmann
Jr. Member
 
Total Posts:  14
Joined:  2009-05-01
 

Hey thanks so much for the response.. I am going to have to do something like this for now but I would still prefer to use their objects/api. This way I know all the proper tables and data is flowing how they designed it too.  But this is going have to do for now.. thanks again!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
bmann
Jr. Member
 
Total Posts:  14
Joined:  2009-05-01
 

Hey thought I would mention for people who read this post that you can get the id via the lastInsertId() method instead of querying the database for it…

$connection->query("insert into eav_attribute_option (attribute_id) values (66)");
$option_id = $connection->lastInsertId();
$connection->query("insert into eav_attribute_option_value (option_id,value) values ($option_id, ‘“.$manu."’)");

Hope this helps.. as your response saved me some time hunting ... thanks..

 
Magento Community Magento Community
Magento Community
Magento Community
 
juice1492
Jr. Member
 
Total Posts:  20
Joined:  2009-02-18
 

In my current project, I’ve needed to create “multiselect” attributes in Magento.  These are handy for selecting media formats (i.e. vhs, dvd, blue-ray) or product colors (red, green, blue, etc).  The following code creates a mutliselect attribute named Media Format with labels of “Media Format” on the front and back ends with values of dvd, vhs, blue-ray.
The array indices of 0 and 1 refer to the Admin or Default Store View (i.e. front end).  This is based on code from the AdminHtml/controllers/Catalog/Product/AttributeController.php script in Magento v. 1.3.2.2.  This was originally posted on my blog (http://www.omnisubsole.com/blog/2009/07/27/adding-mutliselect-attributes-in-magento.html)

#!/usr/bin/php
<?php
define
('MAGENTO'realpath('/var/www/magento'));
ini_set('memory_limit''128M');

require_once 
MAGENTO '/app/Mage.php';

Mage::app();

$model Mage::getModel('catalog/entity_attribute');

$model->setAttributeCode('mediaFormat');//attribute code
$model->setIsComparable(0);
$model->setIsConfigurable(0);    
$model->setIsFilterable(0);
$model->setIsFilterableInSearch(0);    
$model->setIsGlobal(0);
$model->setIsRequired(0);
$model->setIsSearchable(0);    
$model->setIsUnique(0);    
$model->setIsUsedForPriceRules(0);    
$model->setIsVisibleInAdvancedSearch(0);    
$model->setIsVisibleOnFront(0);    
$model->setDefaultValueYesno(0);
$model->setUsedInProductListing(0);    

$model->setFrontendInput('multiselect'); //make it a multiselect/dropdown
//0 is the admin value, 1 is the "default store view" (frontend) value
$frontEndLabel=array('0'=>'Media Format',
                      
'1'=>'Media Format');
                        
$model->setFrontendLabel($frontEndLabel);    
//0 is the admin value, 1 is the "default store view" (frontend) value
$optionData = array('value' =>
                        array(
'option_0'=>array('0'=>'dvd','1'=>'dvd'),
                              
'option_1'=>array('0'=>'vhs','1'=>'vhs'),     
                              
'option_2'=>array('0'=>'blue-ray','1'=>'blue-ray')     
                        )
                    ,
                    
'order' =>
                        array(
'option_0'=>1,
                              
'option_1'=>2,
                              
'option_2'=>3)
               );
$model->setOption($optionData);


$data['backend_model''eav/entity_attribute_backend_array';
$data['apply_to'= array();
$model->addData($data);
$model->setEntityTypeId(Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId());
$model->setIsUserDefined(1);
var_dump($model);

try 
{
    $model
->save();
}
catch(Exception $e{
    
echo $e->getMessage();
}
?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Steve Watson
Jr. Member
 
Total Posts:  20
Joined:  2010-07-21
 

very cool

http://free-magentoextensions.com/extensions/shop-by-manufacturers.html

This extension will really help full you can check that
i install that and it’s working properly now

 
Magento Community Magento Community
Magento Community
Magento Community
 
Steve Watson
Jr. Member
 
Total Posts:  20
Joined:  2010-07-21
 

I am using this extension for manufacturer.
really coooollll.....
http://free-magentoextensions.com/extensions/shop-by-manufacturers.html
try that

 
Magento Community Magento Community
Magento Community
Magento Community
 
addalinkofcharm
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2010-02-07
 

Hello, can anyone Please help me????  We have Magento 1.4.0.1, and up until this month we have added our feeds to google shopping!  However their new policy is that your products have to have a brand, a manufacture number etc.  Our products are Italian Charms, Locket Charms, Pandora Style jewelry....  There are very few items that actually come from a “Manufacture”.  We import our products in from various factories from all over the World.  So 90% we are going to have to submit out own name, and the 10% the brand of the remaining product.

Help I have read everything I can get my hands on for Magento 1.4 without any success!  Please I am NOT a computer geek.  If someone would take the time to put out a detailed step by step example so I can add this I would NOT know how to say, Thank-You!!!!! 

The set up right now is there are NO groups, and many attributes.  We are in between developers at the moment.  We have had two different companies, and both have taken a great advantage over us. I have to find someone I can trust!!!  For the moment though, adding product to google shopping is and will be impossible to receive an approved feed.  We need two columns in the spread sheet that correspond to the live site.  Brands &/or Manufacture and Manufacture Number.

May I say thank you for helping!  In these time of economy issues it is very hard to see the Blue Sky, but the great folks are always there!  You just have to have hope and open your eyes!

 
Magento Community Magento Community
Magento Community
Magento Community
 
DanielCode
Jr. Member
 
Total Posts:  4
Joined:  2013-11-12
 

Hi guys,

This question is connected to the original topic.. How to Add New Brands

I can create the brands from - Admin Panel, Catalog -> Attributes -> Manage Attributes // and they work fine on the website - but no Logo image…

Where can I upload the images for the brand logos… ?  I have looked in the Database -mag_eav_attribute_option_value & that is where the brands are all listed but the HTML image links are not in the table?

I can upload new images to the site “brands” folder - but cant see a way to connect it with code to the brands..

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jase007
Guru
 
Total Posts:  388
Joined:  2013-11-05
 

Hi,

Go>admin>catalog->attributes->manage attributes/catalog->attributes manufactures

Thanks
iLoveMage

 
Magento Community Magento Community
Magento Community
Magento Community
 
FMEExtensions
Mentor
 
Avatar
Total Posts:  1298
Joined:  2009-08-07
 

You can also try Shop by manufacturers plugin, it offers the functionality you are looking for…

http://www.fmeextensions.com/shop-by-manufacturers.html

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2