Magento: Upgrading Magento with a full package

  1. Backup your database
  2. Backup all the code you modified yourself, and don’t forget to keep the original installation archive
  3. Take care of saving the media directory that contains all the uploaded product/category images
  4. Create a backup copy of app/etc/local.xml file
  5. Download a new installation archive
  6. Extract and upload all the files it contains to your server
  7. Delete var/cache and var/session directories
  8. Point your browser to any Magento page
  9. Database upgrades should happen automatically
  10. You are done!

Magento: Display products from a certain category

If you want to display a certain category on a page, add this code on the design tab

<reference name="content">
  <block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
      <action method="setCategoryId"><category_id>[category id here]</category_id></action>
  </block>
</reference>

and then replace [category id here] with your category id.

Magento: List Manufacturers Attribute!!

Go to app/code/core/Mage/Catalog/Block/Product and created a new file called Manufacturer.php and pasted this block code:

public function getAllManu()
    {
      $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);
      return $manufacturers;


    }

Then go to /app/design/frontend/[theme name]/[theme name]/template/catalog/product and created a new .phtml file called manufacturer.phtml and paste this code:

<ul id="manufacturer_list">
    <?php foreach ($this->getAllManu() as $manufacturer): ?>
        <li><a href="<?php Mage::getURL() ?>catalogsearch/advanced/result/?&manufacturer;[]=<?php echo $manufacturer&#91;'value'&#93; ?>"><?php echo $manufacturer&#91;'label'&#93; ?></a></li>
    <?php endforeach; ?>
</ul>

From there log into the backend and created a new page via the CMS menu and inserted the following code:

{{block type="catalog/product_manufacturer" name="home.catalog.product.manufacturer" alias="product_manufacturer" template="catalog/product/manufacturer.phtml"}}

Manufacturer.php
manufacturer.phtml

——————–
Magento ver: 1.3.2.4

Magento: Shop by manufacturer with images

With this mod you can add images.

Images must be the same name as the manufacturer and must end with .jpg

manufacturer.phtml:
/app/design/frontend/default/default/template/catalog/product/

manufacturer.php
/app/code/core/Mage/Catalog/Block/Product/

images:
/media/catalog/brands/

you must alter lines: 30/40/50/60/70 to your own dir.:

<?php if(file_exists('/home/jcsl/public_html/webshop/media/catalog/brands/'.$manufacturer&#91;'label'&#93;.'.jpg')) {echo '<img src="/webshop/media/catalog/brands/'.$manufacturer&#91;'label'&#93;.'.jpg" alt="'.$manufacturer&#91;'label'&#93;.'">';} else { echo ''.$manufacturer['label'].''; } ?></a><br/>

example:
http://www.jcsl.nl/webshop/fabrikanten

Magento version check:
1.3.2.4

Version changes:

1.2:
Images are no longer required, when there is no image a link will apaire.
1.3
In this update there is a way to choose the layout either equil aranged in 6 colloms or displayed in alphabetic order.

manufacturer-1.3

Magento: View the newest products

1- create a new page called ex: Newest arrival
2- go to Design tab and add this code

<reference name="content">
<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page"><action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action></block>
</reference>

3- save the page

——————–
Magento ver: 1.3.2.4

Magento: Create categories grid with images

This tutorial for creating a grid for categories with images.

You can do it without editing the core files of Magento

*Create a new file called “category_listing.phtml” on this directory “app/design/frontend/default/YOUR_TEMPLATE/catalog/navigation/”.

*Add the following code on that file:
(more…)

Magento: Add new container block

You can create a basic “container” as is done with the “right, left, and content” blocks by just adding something like

<block type="core/text_list" name="myblock" as="myblock"></block>

to page.xml. From there you can populate it with content blocks via the layout files as normal.
(more…)

Magento: How to add a new block?

If you want to reference a static block from inside of a CMS page or another static block use this syntax:

{{block  type="cms/block" block_id="my-new-block"}}

If you want to reference a static block from Layout Update XML use this syntax:

<block type="cms/block" name="position-9">
<action method="setBlockId"><block_id>position-9</block_id></action>
</block>

If you want to reference a static block from a PHTML file use this syntax:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('my-new-block')->toHtml() ?>

Moving Magento site To Another Server

MySQL Dump.

backup all files (make sure to archive on a .zip file).

Now you need to create a blank database and import the MySQL dump file to it.
Note: load the SQL dump into Editplus or something similar and search and replace the URLs before importing for example: “http://www.domain.com/test/” replace with “http://www.test.com/”.
(more…)

Page 4 of 512345

Pin It on Pinterest