Skip to content
G31 Zone
  • About
  • Contact

Magento – cms tags

Posted on: October 18, 2010 /
Categories: Magento

Display a magento block in CMS Page: {{block id=’block_id’}} {{block type=’module/package_classname’ template=’path/to/template.phtml’}} Escapes all HTML tags in the value of the var attribute, except for those specified in the value of the allowed_tags attribute. (The latter expects a comma separated list of allowed HTML tags). {{htmlescape var=” allowed_tags=”}} Inserts HTML layout output. The handle attribute

Read More →

Magento – product attribute

Posted on: October 15, 2010 /
Categories: Magento

Get attribute collection: $attribute = $_product->getResource()->getAttribute(‘attribute_name’); Get attribute type: $attribute->getAttributeType(); Get attribute Label: $attribute->getFrontendLabel(); Get attribute default value: $attribute->getDefaultValue(); Check if the attribute is visible: $attribute->getIsVisible(); Check if the attribute is required: $attribute->getIsRequired();

Magento – get product images

Posted on: October 15, 2010 /
Categories: Magento

This code can be used to get all images for product: $_product = Mage::getModel(‘catalog/product’); $_product->load($product_id); // Get image gallery $_gallery = $_product->getMediaGalleryImages(); // Go through each image foreach ($_gallery as $_image) { // Display image echo ‘<img src=\” . $_image->getUrl() . ‘\’ alt=\” . $_image->getLabel() . ‘\’ />’; }

Magento – products block

Posted on: October 7, 2010 /
Categories: Magento

Go to “CMS – Manage Pages” and select the page do you want to display the products from the list of pages. Use next code to display products labeled as “new”: {{block type=”catalog/product_new” name=”catalog.product.new” alias=”new_products” template=”catalog/product/new.phtml”}} Use next code to display all products from catalog: {{block type=”catalog/product_list” name=”catalog.product.list” alias=”all_products” template=”catalog/product/list.phtml”}} Use next code to display

Read More →

Smarty – print array (print_r)

Posted on: October 7, 2010 /
Categories: Smarty

Print an array elements in smarty template: {$my_array|print_r}

PHP – runnig a script in command line

Posted on: October 5, 2010 /
Categories: PHP

To run a script in command line: php test.php or php -f test.php To run a script in command line with parameters: php test.php param1 param2 param3 or php -f test.php param1 param2 param3 The list of used parameters can be found in: $_SERVER[‘argv’]

Php – script execution time

Posted on: October 2, 2010 /
Categories: PHP

To view php script execution time insert next code into your script. Insert next code at the top of the page: <?php $mtime = microtime(); $mtime = explode(” “,$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; ?> Insert next code at the bottom of the page: <?php $mtime = microtime(); $mtime = explode(” “,$mtime);

Read More →

Javascript disable right click (no right click)

Posted on: October 1, 2010 /
Categories: JavaScript

Use this code to disable right click on html pages: <body oncontextmenu=”return false;”>

Magento check if customer is logged in

Posted on: September 29, 2010 /
Categories: Magento

This is a method to verify if a customer is logged in or not: if(Mage::getSingleton(‘customer/session’)->isLoggedIn()) { // Code to execute }

Magento get all products

Posted on: September 29, 2010 /
Categories: Magento

Next code is a method to get all product from magento database: $products = Mage::getModel(‘catalog/product’)->getCollection(); $products->addAttributeToFilter(‘status’, 1);//enabled $products->addAttributeToFilter(‘visibility’, 4); //catalog, search $products->addAttributeToFilter(‘type_id’, ‘simple’); //catalog, search $products->addAttributeToSelect(‘*’); $products->addStoreFilter($storeId); $prodIds = $products->getAllIds(); foreach($prodIds as $productId) { $product = Mage::getModel(‘catalog/product’); $product->load($product_id); }

« 1 … 6 7 8 9 »

Categories

  • Apache
  • CentOS
  • Git
  • HTML
  • HTTP
  • JavaScript
  • JQuery
  • Linux
  • Magento
  • MySQL
  • PHP
  • Regular expression (Regex)
  • Smarty
  • Symfony 2 / Doctrine
  • Twig
  • Ubuntu
  • Uncategorized
  • Zend

Archives

  • June 2015
  • May 2015
  • March 2015
  • September 2014
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • January 2013
  • October 2012
  • August 2012
  • May 2012
  • April 2012
  • January 2012
  • December 2011
  • November 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010

Recent Posts

  • Connect to VPN from Linux
  • Enable slow query log on MySQL server
  • Doctrine Console Commands
  • Symfony2 Doctrine debug query
  • Mysqldump only tables with certain prefix

Tags

ajax all post data apache asynchronously bookmark categories images category category thumbnail create subdomain create virtualhost git git basics git force overwrite git pull htaccess html html codes HTTP status codes JavaScript javascript getcookie javascript get url javascript setcookie javascript strip tags javascript strip_tags jquery jquery.validator jquery ajax jquery bookmark jquery validator rule Lorem ipsum Magento mysql php preview button preview target blank print array products redirect www soap soap client soap sample soap server status codes zend framework 1 zend trace mysql errors

Copyright G31 Zone 2026 | Theme by Theme in Progress | Proudly powered by WordPress