Pages

Saturday, July 12, 2014

How to download extensions from Magento Connect manually

Usually you need to install at some point extensions for your Magento shop.
Best practice is to install it manually. That's to keep control and check, whether the extension is ok without breaking your shop installation. There are two ways to do it.

Either you go to freegento.com/ddl-magento-extension.php and enter the extension key from Magento Connect. As result, you get a download link for your module.


Or you use mage, a shell provided by Magento.
Got to the root of your test store

orion:~ user$ cd /Users/user/dev/magento/latest


If you use it the first time, you need to adapt the permissions

orion:~ user$ chmod 550 mage
orion:~ user$ ./mage

Connect commands available:
===========================
channel-add          Add a Channel       
channel-alias        Specify an alias to a channel name
channel-delete       Remove a Channel From the List
channel-info         Retrieve Information on a Channel
channel-login        Connects and authenticates to remote channel server
channel-logout       Logs out from the remote channel server
clear-cache          Clear Web Services Cache
config-get           Show One Setting    
config-help          Show Information About Setting
config-set           Change Setting      
config-show          Show All Settings   
convert              Convert old magento PEAR package to new format
download             Download Package    
info                 Display information about a package
install              Install Package     
install-file         Install Package Archive File
list-available       List Available Packages
list-channels        List Available Channels
list-files           List Files In Installed Package
list-installed       List Installed Packages In The Default Channel
list-upgrades        List Available Upgrades
package              Build Package       
package-dependencies Show package dependencies
package-prepare      Show installation information of package
sync                 Synchronize Manually Installed Packages
sync-pear            Synchronize already Installed Packages by pear
uninstall            Un-install Package  
upgrade              Upgrade Package     
upgrade-all          Upgrade All Packages
If you get the command list above, everything works as it should.
Now you can download your extension, like

orion:~ user$ ./mage install http://connect20.magentocommerce.com/community extension_name

Thursday, July 10, 2014

How to get a list of manufacturers ids

To get an array of the manufacturer names & ids use the following code:


$product = Mage::getModel('catalog/product');
$attributes =Mage::getResourceModel('eav/entity_attribute_collection')
  ->setEntityTypeFilter($product->getResource()->getTypeId())
  ->addFieldToFilter('attribute_code', 'manufacturer');
$attribute = $attributes->getFirstItem()
  ->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);


you can test code snippet like above with a php shell as provided in Magento PHP Developer's Guide (p.58)


the result looks similar to this:

magento > print_r($manufacturers);
Array
(
  [0] => Array
  (
   [value] => 6
   [label] => Manfucturer A
  )
  [1] => Array
  (
   [value] => 20
   [label] => Manfucturer B
  )
  [2] => Array
  (
   [value] => 21
   [label] => Manfucturer C
  )
  [3] => Array
  (
   [value] => 27
   [label] => Manfucturer D
  )
)
magento >


Saturday, July 5, 2014

Installing JPEGTRAN with drop support on a Mac

JPEGTRAN is needed for jpeg optimizations, especially if you like to do some web scraping and
the images are only accessible behind zoomify. But this is something for another post.

Installation 

  1. Get the source code from here: http://www.ijg.org/
  2. Download jpegsrc.v9a.tar.gz
  3. Get the patch from here: http://jpegclub.org/jpegtran/
  4. Download droppatch.v9a.tar.gz
  5. Uncompress the package, i.e. tar -xzvf /tmp/jpegsrc.v9a.tar.gz
  6. Uncompress the patch to the same directory as jpegtran, i.e. 
    tar -C jpeg-9a -xzvf droppatch.v9a.tar.gz 
  7. Go to the directory that contains the uncompressed original code with the patch, i.e 
    cd /tmp/jpeg-9a
  8. if you don't want to install it to the default locations, add the --prefix arg otherwise without, ./configure --prefix=/some/installation/path/ 
  9. make && make install (you need sudo for installation to default path)
Done!




Thursday, July 3, 2014

How to disable Paypal logo in Magento 1.9.x

had some difficulty to find valid information on how to disable Paypal logo in Magento 1.9.x.
For older versions, there was a setting in Configuration/Payment method/paypal something and enable/disable logo in frontend.

The proper way is to disable it in your local.xml file located
[your_magento_installation]app/design/frontend/[your_template]/[your_package]/local.xml

add the remove tag within
<layout>
             <default>
                  [...]
                  <remove name="paypal.partner.right.logo"/>
                  [...]
             </default>
</layout>

if it doesn't work, there is always a lumberjack method... overwrite the default behaviour from the default template.

So copy from [your_magento_installation]app/design/frontend/base/default/template/paypal/partner/logo.phtml
to  [your_magento_installation]app/design/frontend/[your_template]/default/template/paypal/partner/logo.phtml

and remove the php code.



Dummy style but effective...

if you know the right way to do it over the admin panel, please let me know!
thx