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…)

Joomla 1.5: How translate poll options with Joom!fish?

Joomla: 1.5.x
JoomFish: 2.0.4

Just change the modules/mod_poll/helper.php file a bit:
in getPollOptions function set

$query = 'SELECT p.id, p.text' .
            ' FROM #__poll_data as p' .
            ' WHERE p.pollid = ' . (int) $id .
            ' AND p.text <> ""' .
            ' ORDER BY p.id';

Joomfish rules !
You have to use table alias with your queries!
I hope it will be fixed on next version!

Joomla 1.5: How to remove "Joomla SEF URLs by Artio" in artio joomsef?

To remove “Joomla SEF URLs by Artio” in your page, download this necessary file using ftp:
/components/com_sef/joomsef.php
then use an editor to open the file then comment line 1771 and 1772
line 1771 and 1772 looks like this

 if (JRequest::$cosi('fo'.'rmat') != 'r'.'aw')
    $doc->$cache($cacheBuf . base64_decode($cacheBuf2), 'component');

So this will look like this now

/*
 if (JRequest::$cosi('fo'.'rmat') != 'r'.'aw')
    $doc->$cache($cacheBuf . base64_decode($cacheBuf2), 'component');
*/

(more…)

PHP: How to Get the Current Page URL

If you want to get the current page URL, you can use the following code:

<?php
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER&#91;"HTTPS"&#93; == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER&#91;"SERVER_PORT"&#93; != "80") {
  $pageURL .= $_SERVER&#91;"SERVER_NAME"&#93;.":".$_SERVER&#91;"SERVER_PORT"&#93;.$_SERVER&#91;"REQUEST_URI"&#93;;
 } else {
  $pageURL .= $_SERVER&#91;"SERVER_NAME"&#93;.$_SERVER&#91;"REQUEST_URI"&#93;;
 }
 return $pageURL;
}
?>
<?php
  echo curPageURL();
?>
Page 22 of 24«18192021222324

Pin It on Pinterest