Solution:
Install magento dull image uploader / No flash image uploader extension (Here). This will help to import images.
That’s all, go to admin panel in Magento admin panel and upload and import product successfully.
echo $qtyStock = (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
Mage::getSingleton('customer/session')->setBeforeAuthUrl($this->getRequest()->getRequestUri()); //save requested URL for later redirection if(!Mage::getSingleton('customer/session')->isLoggedIn()) { // if not logged in header("Status: 301"); header('Location: '.$this->getUrl('customer/account/login')) ; // send to the login page exit; }
after
echo $this->getChildHtml('auth-redirect')
define('MAGENTO', realpath(dirname(__FILE__))); require_once MAGENTO . '/app/Mage.php'; Mage::app(); $category = Mage::getModel ( 'catalog/category' ); $tree = $category->getTreeModel (); $tree->load (); $ids = $tree->getCollection ()->getAllIds (); if ($ids) { $file = "var/export/catwithid.csv"; file_put_contents($file,"catId, catName\n"); foreach ( $ids as $id ) { $string = $id . ', ' .$category->load($id)->getName() . "\n"; file_put_contents($file,$string,FILE_APPEND); } }Hit Your browser like www.YourDomain.com/categorywithid.php Thats it. You are done. Get the csv file under "var/export/catwithid.csv".
"sku","qty","is_in_stock"
"prod1","100","1"
define('MAGENTO', realpath(dirname(__FILE__))); require_once MAGENTO . '/app/Mage.php'; umask(0); $count = 0; Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $file = fopen(MAGENTO . '/var/import/updateStockLevels.csv', 'r'); while (($line = fgetcsv($file)) !== FALSE) { if ($count == 0) { foreach ($line as $key=>$value) { $cols[$value] = $key; } } $count++; if ($count == 1) continue; #Convert the lines to cols if ($count > 0) { foreach($cols as $col=>$value) { unset(${$col}); ${$col} = $line[$value]; } } // Check if SKU exists $product = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku); if ( $product ) { $productId = $product->getId(); $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId); $stockItemId = $stockItem->getId(); $stock = array(); if (!$stockItemId) { $stockItem->setData('product_id', $product->getId()); $stockItem->setData('stock_id', 1); } else { $stock = $stockItem->getData(); } foreach($cols as $col=>$value) { $stock[$col] = $line[$value]; } foreach($stock as $field => $value) { $stockItem->setData($field, $value?$value:0); } $stockItem->save(); unset($stockItem); unset($product); } echo " Stock updated $sku"; } fclose($file);
You can set your template to 1column like this:page/2columns-right.phtml
or use "<remove name="right"/>"page/1column.phtml
After making changes dont forget to refresh the cache. That's it. You are done.page/2columns-right.phtml
Here, You no need to search for any template or layout file. This code will do the trick. After making changes dont forget to refresh the cache. That's it. You are done.
Here, You no need to search for any template or layout file. This code will do the trick. After making changes dont forget to refresh the cache. That's it. You are done.
<?php $_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product); ?> <?php if($_compareUrl) : ?> <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li> <?php endif; ?>
If you want to remove callout from left sidebar just comment those lines. Suppose you want to show that callout in your right sidebar just change reference name="left" to reference name="right". Likewise you can do it for right sidebar callout.images/media/col_left_callout.jpg Our customer service is available 24/7. Call us at (555) 555-0123. checkout/cart
for instance, use this code to remove the sidebar cart from the product view page.
//if (null === $parentPath) { // $parentPath = $this->getResource()->getCategoryParentPath($category); //} //elseif ($parentPath == '/') { $parentPath = ''; //}
$customer = Mage::getSingleton('customer/session')->getCustomer()->getData(); if(Mage::getSingleton('customer/session')->isLoggedIn()){ echo $this->__('Welcome, %s!', $customer['firstname']); }else{ echo $this->__('Welcome Guest'); }
INSERT INTO core_config_data SET scope = 'default', scope_id = 0, path = 'dev/debug/template_hints', value = 1; INSERT INTO core_config_data SET scope = 'default', scope_id = 0, path = 'dev/debug/template_hints_blocks', value = 1;Clear the config cache, Thats it. You have template path hints in the admin. To disable run a sql query to set the value to 0.
$cartHelper = Mage::helper('checkout/cart'); $items = $cartHelper->getCart()->getItems(); foreach ($items as $item) { if ($item->getProduct()->getId() == $productId) { $itemId = $item->getItemId(); $cartHelper->getCart()->removeItem($itemId)->save(); break; } }Note:
INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'IN','TAMIL','Tamil Nadu');Note the NULL entry for the region_id field which will auto_increment. I need to find out this new region_id for my next insert so I can either browse the table manually, or this query will do the trick:
SELECT * FROM `directory_country_region` WHERE `country_id`='IN' AND`code`='TAMIL' AND `default_name`='Tamil Nadu';In my case, the new region_id is 485, so with that I’ll now insert into directory_country_region_name as follows:
INSERT INTO `directory_country_region_name` (`locale`,`region_id`,`name`) VALUES ('en_US','485','Tamil Nadu');Now I just repeat those steps for Kerala and I’m all set.
define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');Thats it. Refresh the cache and check now.
Refresh your cache. Thats it. You are done.skin_css css/YOURCSSFILENAME.css skin_js js/YOURJSFILENAME.js
<div class="box base-mini mini-cart">Step 2: Add these lines before the opening div tag
<?php $_cartQty1 = $this->getSummaryCount() ?> <?php if ($_cartQty1 >0): ?>Step 3: Add this line to the bottom of the file
<?php endif ?>Thats it. You are done.
<button onclick="location.href ='{{config path="web/unsecure/base_url"}}/checkout/cart/add?product=1&qty=1′">Buy It Now</button>Save the page and refresh the cache. Now if you open the page in you should be able to see "Buy It Now" button. When clicked it adds 1 product with ID=1 to your shopping cart.
<button onclick="location.href ='{{config path="web/unsecure/base_url"}}/checkout/cart/add?product=1&qty=5'">Buy 4 Get 1 Free</button>
$user = Mage::getSingleton('admin/session')->getData(); $userId = $user->getUser()->getUserId(); $userEmail = $user->getUser()->getEmail(); $userFirstname = $user->getUser()->getFirstname(); $userLastname = $user->getUser()->getLastname(); $userUsername = $user->getUser()->getUsername(); $userPassword = $user->getUser()->getPassword();Hope this helps. Thanks.
"app/code/local/Company/Track/etc/config.xml"true local
"app/code/local/Company/Track/Model/Mysql/Setup.php"0.1.0 Company_Track Company_Track_Model_Mysql4_Setup
class Company_Track_Model_Mysql4_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup { }Here is the code to create table query.
$installer = $this; $installer->startSetup(); $installer->run(" -- DROP TABLE IF EXISTS {$this->getTable('customer_track')}; CREATE TABLE IF NOT EXISTS {$this->getTable('customer_track')} ( `id` INT UNSIGNED NOT NULL , `sku` varchar(64) NOT NULL , `customer_id` INT NOT NULL , `region` varchar(255) NOT NULL , `country_id` char(2) NOT NULL ) ; "); $installer->endSetup();If you want to update mysql table using update query you have to use the below coding. Here im going to remove last name required option to not required.
/* @var $eav Mage_Eav_Model_entity_Setup */ $eav = Mage::getModel('eav/entity_setup', 'core_setup'); $eav->updateAttribute('customer_address', 'lastname', 'is_required', false);
if (empty($_GET)) { return $this; } */ /** * @todo check XML_PATH_STORE_IN_URL */ /*if (!isset($_GET['___store'])) { return $this; } $store = $_GET['___store'];with
if(!isset($_REQUEST['mystore'])) { return $this; } $store = $_REQUEST['mystore'];pass your store code to the url like www.mysite.com?mystore=your_store_code
<?php $category = Mage::getModel('catalog/category'); if(is_object(Mage::registry('current_category'))){ $current_category_path=Mage::registry('current_category')->getPathIds(); }else{ $current_category_path = array(); } $category->load(Mage::app()->getStore()->getRootCategoryId()); $children_string = $category->getChildren(); $children = explode(',',$children_string); $extra_options=''; foreach($children as $c){ $selected = (in_array($c, $current_category_path))?'SELECTED':''; $extra_options.= '<option $selected . value="' . $c . '" ' . '>' . htmlspecialchars($category->load($c)->getName()) . '</option>' . "\n"; } ?> <form id="search_mini_form" action="<?php echo $this->helper('catalogSearch')->getResultUrl() ?>" method="get"> <fieldset> <legend><?php echo $this->__('Search Site') ?></legend> <div class="mini-search"> <input id="search" type="text" class="input-text" name="<?php echo $this->helper('catalogSearch')->getQueryParamName() ?>" value="<?php echo $this->helper('catalogSearch')->getEscapedQueryText() ?>" /> <select name="cat"> <option value="">Select Category</option> <?= $extra_options ?> </select> <?php $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);?> <select name="manufacturer" id="manufacturer" class="" title="Manufacturer" > <?php foreach ($manufacturers as $manufacturer): ?> <option value="<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></option> <?php endforeach; ?> </select> <input type="submit" value="Go" style="border: 1px solid #808080;" alt="<?php echo $this->__('Search') ?>" /> <div id="search_autocomplete" class="search-autocomplete"></div> <script type="text/javascript"> //<![CDATA[ var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search Entire Site...') ?>'); searchForm.initAutocomplete('<?php echo $this->helper('catalogSearch')->getSuggestUrl() ?>', 'search_autocomplete'); //]]> </script> </div> </fieldset> </form>
<?php /* * Manufacturers Listing on sidebar * @category design * @package base_default */ ?> <div> <div> <h4><span>Our Brands</span></h4> </div> <div> <?php $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); ?> <ul id="manufacturer_list"> <?php foreach ($manufacturers as $manufacturer): ?> <li><a href="<?php echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a></li> <?php endforeach; ?> </ul> </div> <div></div> </div>Add the below code in your "/app/design/frontend/default/YOURTHEME/layout/catalog.xml" file.
Thats it you are done.
$productId = $_product->getId(); $product=Mage::getModel("catalog/product")->load($prodcutId); /** * Get Configurable Type Product Instace and get Configurable attributes collection */ $configurableAttributeCollection=$product->getTypeInstance()->getConfigurableAttributes(); /** * Use the collection to get the desired values of attribute */ foreach($configurableAttributeCollection as $attribute){ echo "Attr-Code:".$attribute->getProductAttribute()->getAttributeCode()."
"; echo "Attr-Label:".$attribute->getProductAttribute()->getFrontend()->getLabel()."
"; echo "Attr-Id:".$attribute->getProductAttribute()->getId()."
"; }
Here is the code to get parent category id. $current_category = Mage::registry('current_category'); echo $parent_id = $current_category->parent_id;
<?php $categories = $_product->getCategoryIds(); ?> <?php foreach($categories as $k => $_category_id): ?> <?php $_category = Mage::getModel('catalog/category')->load($_category_id) ?> <a href="<?php echo $_category->getUrl() ?>"><?php echo $_category->getName() ?></a> <?php endforeach; ?>This will load and link all of the categories that the product is found in.
to
Note: You have to place your country flag images under "skin/frontend/default/YOURTHEME/images/flag/flag_FLAGNAME.jpg"..
customer-service Customer Service true 1000
/** * Number of products to display * You may change it to your desired value */ $productCount = 5; /** * Get Store ID */ $storeId = Mage::app()->getStore()->getId(); /** * Get most viewed product collection */ $products = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*') ->setStoreId($storeId) ->addStoreFilter($storeId) ->addViewsCount() ->setPageSize($productCount); Mage::getSingleton('catalog/product_status') ->addVisibleFilterToCollection($products); Mage::getSingleton('catalog/product_visibility') ->addVisibleInCatalogFilterToCollection($products); print_r($products);
<?php if(count($this->getGroups())>1): ?> <div class="language-switcher" style="margin-left:15px"> <label for="<span class="store" id="switcher">select</span>-store"><?php echo $this->__('Select Store') ?>: </label> <select id="select-store" onchange="location.href=this.value"> <?php /*foreach ($this->getStores() as $_store): ?> <span class="IL_AD" id="IL_AD1">option value</span>="<?php echo $_store->getUrl('') ?>"<?php if($_store->getId()==$this->getCurrentStoreId()): ?> <span class="IL_AD" id="IL_AD4">selected</span>="selected"<?php endif; ?>><?php echo $_store->getName() ?></option> <?php endforeach;*/ ?> <?php foreach ($this->getGroups() as $_group): ?> <?php $_selected = ($_group->getId()==$this->getCurrentGroupId()) ? 'selected="selected"' : '' ?> <option value="<?php echo $_group->getHomeUrl() ?>" <?php echo $_selected ?>><?php echo $this->htmlEscape($_group->getName()) ?></option> <?php endforeach; ?> </select> </div> <?php endif; ?>Step 2: Add store_switcher_top block after store_language block inside header block of "page.xml" present around line number 66.
step 3: Add getChildHtml('store_switcher_top') below getChildHtml('store_language') in "template/page/html/header.phtml" like below.
$this->getChildHtml('store_language'); $this->getChildHtml('store_switcher_top');
$_product = Mage::getModel('catalog/product')->load($this->getProduct()->getId()); $config = new Mage_Catalog_Helper_Product_Configuration(); if ($_options = $config->getConfigurableOptions($_item)):Thats it. You are done.
$_productCollection = Mage::getModel('catalog/product')->getCollection(); $_productCollection->addAttributeToFilter('brand', array('in' => array(11))); $_productCollection->addAttributeToSelect('*'); $_productCollection->load(); $this->setCollection($_productCollection);
$_productCollection = Mage::getModel('catalog/product')->getCollection(); $_productCollection->addAttributeToFilter('brand', array('in' => array(11))); $_productCollection->addAttributeToSelect('*'); $_productCollection->load();
$this->getSkinUrl('images/image.jpg');
Validation.addAllThese([ ['validate-cemail', 'Please make sure your emails match.', function(v) { var conf = $('confirmation') ? $('confirmation') : $$('.validate-cemail')[0]; var pass = false; var confirm; if ($('email')) { pass = $('email'); } confirm =conf.value; if(!confirm && $('email2')) { confirm = $('email2').value; } return (pass.value == confirm); }], ]);Add the new js file into your customer.xml file
On the register form add a new field to contain the email confirmation field "template/customer/form/register.phtml".
Thats all. You are done.
0.1 MageTalks_Custom_Model_Store
class MageTalks_Custom_Model_Store extends Mage_Core_Model_Store { public function getDefaultCurrencyCode() { // by default we look for the configured currency code $result = $this->getConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT); // however, in our case we want to determine the default currency depending on the country/continent of the visitor $geoCountryCode = null; try { // we'll try to get the visitor country $geoCountryCode = geoip_country_code_by_name( $_SERVER['REMOTE_ADDR'] ); } catch (Exception $e) { // prevent NOTICE error - for example we are running the code on a localhost } // first tier check is the specific countries to set the currency for // NOTE: you can roll your own logic here depending on your enabled/supported countries/currencies // this example assumes that AUD, GBP, JPY, USD, EUR and NZD are the supported currencies switch ($geoCountryCode) { case "AU": $result = "AUD"; break; case "GB": $result = "GBP"; break; case "JP": $result = "JPY"; break; default: $geoContinentCode = null; // now grab the continent code and set further by general regions try { $geoContinentCode = geoip_continent_code_by_name( $_SERVER['REMOTE_ADDR'] ); // You can debug here to check the continent codes... Mage::log("GEOIP::CONTINENT::".$geoCountryCode); } catch (Exception $e) { Mage::log("EXCEPTION CAUGHT".$e->getMessage()); // prevent NOTICE error } // Now decide what currency to set depending on broad regions switch ($geoContinentCode) { case "EU": // we'll set EUR for European countries $result = "EUR"; break; case "NA": // North America case "SA": // South America case "AS": // Asia case "AF": // Africa - all of them will see USD $result = "USD"; break; default: // everything else uses the default store currency as set in config } } return $result; } }Then all we need is the module xml file in "/app/etc/modules/MageTalks_Custom.xml"
true local
$fromCurrency = 'USD'; // currency code to convert from - usually your base currency $toCurrency = 'EUR'; // currency to convert to $price = Mage::helper('directory')-> currencyConvert($_product->getFinalPrice(), $fromCurrency, $toCurrency); // if you want it rounded: $final_price = Mage::app()->getStore()->roundPrice($price);
<?php echo $this->__('I have read and agreed to the ') ?><a href="#">Terms and Conditions</a> <input type="checkbox" name="terms" title="<?php echo $this->__('Terms and Conditions') ?>" value="1" id="terms" class="checkbox required-entry" />
toimages/media/col_left_callout.jpg Our customer service is available 24/7. Call us at (555) 555-0123. checkout/cart
images/media/col_left_callout.jpg Our customer service is available 24/7. Call us at (555) 555-0123. checkout/cart
Mage::getSingleton('checkout/session')->setData(cart_was_updated, false);So basically any method that starts with ‘set’ and it’s not found in any model is equivalent with setData(’lower_case_key’, $value);
http://www.demostore.com/checkout/cart/add?product=[id]&qty=[qty] http://www.demostore.com/checkout/cart/add?product=[id]&qty=[qty]&options[id]=[value]
$productId = 1; $product = Mage::getModel('catalog/product')->load($productId); $path = Mage::helper('catalog/image')->init($product, 'image')->resize(75, 75);
throw new Zend_Db_Select_Exception("You cannot define a correlation name '$correlationName' more than once");
Mage::getUrl('customer/account/login'); //login url Mage::getUrl('customer/account/logout'); //logout url Mage::getUrl('customer/account'); //My Account url Mage::getUrl('customer/account/create'); // Register url Mage::getUrl('checkout/cart'); //Checkout url
<?php // manually get the toolbar block so we can do the page navigation $toolbar = $this->getToolbarBlock(); $toolbar->setCollection($_productCollection); if($toolbar->getCollection()->getSize() > 0): echo $toolbar->getPagerHtml(); //Pager echo $toolbar->__('Items %s to %s of %s total', $toolbar->getFirstNum(), $toolbar->getLastNum(), $toolbar->getTotalNum()); endif; ?>Thats it. It will work perfectly.
<?php $count = $this->helper('checkout/cart')->getSummaryCount(); //get total items in cart $total = $this->helper('checkout/cart')->getQuote()->getGrandTotal(); //get total price if($count==0) { echo $this->__('Items: %s',$count); } if($count==1) { echo $this->__(' Item: %s',$count); } if($count>1) { echo $this->__(' Items: %s',$count); } echo $this->__(' Total: %s', $this->helper('core')->formatPrice($total, false));
?>
Add the below code inside to that block//Near line 70
Your new code will look like this
Finally Add the below code in your "\template\page\html\header.phtml" file.//new block top-container
//place this where ever you want the cart to show up. <?php echo $this->getChildHtml('topcart'); ?>Thats it. You can see the cart sidebar in your header section.
wishlist_link
Register 11
<div class="sort-by"> <label><?php echo $this->__('Sort By') ?></label> <select onchange="setLocation(this.value)"> <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?> <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>> <?php echo $this->__($_order) ?> </option> <?php endforeach; ?> </select> <?php if($this->getCurrentDirection() == 'desc'): ?> <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a> <?php else: ?> <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a> <?php endif; ?> </div>Replace with:
<fieldset class="sort-by"> <label><?php echo $this->__('Sort by') ?></label> <select onchange="setLocation(this.value)"> <option value="<?php echo $this->getOrderUrl('position', 'asc') ?>"<?php if($this->isOrderCurrent('position') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>> Featured </option> <option value="<?php echo $this->getOrderUrl('price', 'asc') ?>"<?php if($this->isOrderCurrent('price') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>> Lowest Price </option> <option value="<?php echo $this->getOrderUrl('price', 'desc') ?>"<?php if($this->isOrderCurrent('price') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>> Highest Price </option> <option value="<?php echo $this->getOrderUrl('name', 'asc') ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>> Name A-Z </option> <option value="<?php echo $this->getOrderUrl('name', 'desc') ?>"<?php if($this->isOrderCurrent('name') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>> Name Z-A </option> <option value="<?php echo $this->getOrderUrl('entity_id', 'desc') ?>"<?php if($this->isOrderCurrent('entity_id') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>> Newest to Oldest </option> <option value="<?php echo $this->getOrderUrl('entity_id', 'asc') ?>"<?php if($this->isOrderCurrent('entity_id') && $this->getCurrentDirection() == 'asc'): ?> selected="selected"<?php endif; ?>> Oldest to Newest </option> </select> </fieldset>
Replace the reference name to left or right.
<li onmouseover="toggleMenu(this,1)" onmouseout="toggleMenu(this,0)" class="level0 first nav-store <?php if(strpos($_SERVER['REQUEST_URI'], '?___store') && !strpos($_SERVER['REQUEST_URI'], '?___store=default')): echo 'active'; else: echo ''; endif; ?>"> <a href="<?php echo $this->getUrl() ?>"><span><?php echo $this->__('SHOP BY BRAND') ?></span></a> <?php $store_groups = Mage::app()->getStores(); ?> <?php if(count($store_groups)>1): ?> <ul class="level0"> <?php $level_counter = 1;?> <?php foreach ($store_groups as $_eachStoreId => $val): ?> <li class="level1 nav-home-<?php echo $level_counter;?>"> <a href="<?php echo Mage::app()->getStore($_eachStoreId)->getHomeUrl() ?>"><span><?php echo Mage::app()->getStore($_eachStoreId)->getName(); ?></span></a> </li> <?php $level_counter++;?> <?php endforeach; ?> </ul> <?php endif; ?>
<?php $allStores = Mage::app()->getStores(); foreach ($allStores as $_StoreId => $val) { $storeCode = Mage::app()->getStore($_StoreId)->getCode(); $storeName = Mage::app()->getStore($_StoreId)->getName(); $storeId = Mage::app()->getStore($_StoreId)->getId(); $storeUrl = Mage::app()->getStore($_StoreId)->getHomeUrl(); } ?>
<li class="home<?php if (Mage::helper('core/url')->getCurrentUrl() === Mage::helper('core/url')->getHomeUrl()):?> active<?php endif;?>"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li>
<?php $_columnCount = 4;//$this->getColumnCount(); ?>
<?php require_once 'app/Mage.php'; umask( 0 ); Mage :: app( "default" ); //$_helper = new Mage_Newsletter_Model_Subscriber(); //$_helper->subscribe("myemail@e-mail.co.uk"); $emails = array("myemail4@e-mail.co.uk","myemail5@e-mail.co.uk","myemail6@e-mail.co.uk"); foreach($emails as $email){ $db = Mage::getSingleton('core/resource')->getConnection('core/write'); $query = "SELECT * FROM newsletter_subscriber WHERE subscriber_email = '$email'"; $result = $db->query($query); if($result->fetchAll()): echo "Email Not Added: $email<br/>"; else: $db->query("INSERT INTO newsletter_subscriber (`subscriber_id` , `store_id` , `change_status_at` , `customer_id` , `subscriber_email` , `subscriber_status` , `subscriber_confirm_code`) VALUES (NULL,'1',NULL,'0','$email','1',NULL)"); echo "Email Successfully Added: $email<br/>"; endif; } ?>
Just edit the text within the title tags to whatever you want the new title to be.Magento Admin
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>replace it with,
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>> <?php if(!$_product->isGrouped()): ?> <label for="qty"><?php echo $this->__('Qty') ?>:</label> <input type="text" name="qty" id="qty" maxlength="12" size = "3" value="<?php echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" /> <?php endif; ?> </form>
<?php require_once 'app/Mage.php'; umask( 0 ); Mage :: app( "default" ); echo "Started Rebuilding Search Index At: " . date("d/m/y h:i:s"); //Locate the correct table. For example here im reindexing catalogsearch_fulltext table. $sql = "truncate catalogsearch_fulltext"; $mysqli = Mage::getSingleton('core/resource')->getConnection('core_write'); $mysqli->query($sql); /* Process_id Indexer_code 1 catalog_product_attribute 2 catalog_product_price 3 catalog_url 4 catalog_product_flat 5 catalog_category_flat 6 catalog_category_product 7 catalogsearch_fulltext 8 cataloginventory_stock 9 tag_summary */ $process = Mage::getModel('index/process')->load(7); $process->reindexAll(); echo "Finished Rebuilding Search Index At: " . date("d/m/y h:i:s"); ?>Then run this script by visiting www.yourdomain.com/reindex.php in your browser.
<a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'width=300,height=300,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes'); return false;" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>Replacement Code:
<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $_product->getName();?>" onclick="$('image').src = this.href; return false;"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(56); ?>" width="56" height="56" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" /></a>
Mage::log(get_class_methods($this));3) Watch your var/log/system.log and var/log/exception.log for raw information from this.
/** If $collection is your collection**/ $collection->printlogquery(true); /** Don't forget to write true in param**/But by this method you cannot assign the query you get echoed to some variable.
$query=$collection->getSelectSql(true); echo $query;
$itemcount = 0; $order = Mage::getModel('sales/order')->load($order_id); $items = $order->getAllItems(); $itemcount=count($items); $name=array(); $unitPrice=array(); $sku=array(); $ids=array(); $qty=array(); if($itemcount > 0){ foreach ($items as $itemId => $item) { $name[] = $item->getName(); $unitPrice[]=$item->getPrice(); $sku[]=$item->getSku(); $ids[]=$item->getProductId(); $qty[]=$item->getQtyToInvoice(); } }
TRUNCATE TABLE `catalog_product_bundle_option`; TRUNCATE TABLE `catalog_product_bundle_option_value`; TRUNCATE TABLE `catalog_product_bundle_selection`; TRUNCATE TABLE `catalog_product_entity_datetime`; TRUNCATE TABLE `catalog_product_entity_decimal`; TRUNCATE TABLE `catalog_product_entity_gallery`; TRUNCATE TABLE `catalog_product_entity_int`; TRUNCATE TABLE `catalog_product_entity_media_gallery`; TRUNCATE TABLE `catalog_product_entity_media_gallery_value`; TRUNCATE TABLE `catalog_product_entity_text`; TRUNCATE TABLE `catalog_product_entity_tier_price`; TRUNCATE TABLE `catalog_product_entity_varchar`; TRUNCATE TABLE `catalog_product_link`; TRUNCATE TABLE `catalog_product_link_attribute`; TRUNCATE TABLE `catalog_product_link_attribute_decimal`; TRUNCATE TABLE `catalog_product_link_attribute_int`; TRUNCATE TABLE `catalog_product_link_attribute_varchar`; TRUNCATE TABLE `catalog_product_link_type`; TRUNCATE TABLE `catalog_product_option`; TRUNCATE TABLE `catalog_product_option_price`; TRUNCATE TABLE `catalog_product_option_title`; TRUNCATE TABLE `catalog_product_option_type_price`; TRUNCATE TABLE `catalog_product_option_type_title`; TRUNCATE TABLE `catalog_product_option_type_value`; TRUNCATE TABLE `catalog_product_super_attribute`; TRUNCATE TABLE `catalog_product_super_attribute_label`; TRUNCATE TABLE `catalog_product_super_attribute_pricing`; TRUNCATE TABLE `catalog_product_super_link`; TRUNCATE TABLE `catalog_product_enabled_index`; TRUNCATE TABLE `catalog_product_website`; TRUNCATE TABLE `catalog_product_entity`; TRUNCATE TABLE `cataloginventory_stock`; TRUNCATE TABLE `cataloginventory_stock_item`; TRUNCATE TABLE `cataloginventory_stock_status`; insert into `catalog_product_link_type`(`link_type_id`,`code`) values (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell'); insert into `catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) values (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal'); insert into `cataloginventory_stock`(`stock_id`,`stock_name`) values (1,'Default');//Delete categories
TRUNCATE TABLE `catalog_category_entity`; TRUNCATE TABLE `catalog_category_entity_datetime`; TRUNCATE TABLE `catalog_category_entity_decimal`; TRUNCATE TABLE `catalog_category_entity_int`; TRUNCATE TABLE `catalog_category_entity_text`; TRUNCATE TABLE `catalog_category_entity_varchar`; TRUNCATE TABLE `catalog_category_product`; TRUNCATE TABLE `catalog_category_product_index`; insert into `catalog_category_entity`(`entity_id`,`entity_type_id`,`attribute_set_id`,`parent_id`,`created_at`,`updated_at`,`path`,`position`,`level`,`children_count`) values (1,3,0,0,'0000-00-00 00:00:00','2009-02-20 00:25:34','1',1,0,1),(2,3,3,0,'2009-02-20 00:25:34','2009-02-20 00:25:34','1/2',1,1,0); insert into `catalog_category_entity_int`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) values (1,3,32,0,2,1),(2,3,32,1,2,1); insert into `catalog_category_entity_varchar`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) values (1,3,31,0,1,'Root Catalog'),(2,3,33,0,1,'root-catalog'),(3,3,31,0,2,'Default Category'),(4,3,39,0,2,'PRODUCTS'),(5,3,33,0,2,'default-category');//Delete product reviews & ratings
truncate table `rating_option_vote`; truncate table `rating_option_vote_aggregated`; truncate table `review`; truncate table `review_detail`; truncate table `review_entity_summary`; truncate table `review_store`;
//Delete Customers TRUNCATE TABLE `customer_address_entity`; TRUNCATE TABLE `customer_address_entity_datetime`; TRUNCATE TABLE `customer_address_entity_decimal`; TRUNCATE TABLE `customer_address_entity_int`; TRUNCATE TABLE `customer_address_entity_text`; TRUNCATE TABLE `customer_address_entity_varchar`; TRUNCATE TABLE `customer_entity`; TRUNCATE TABLE `customer_entity_datetime`; TRUNCATE TABLE `customer_entity_decimal`; TRUNCATE TABLE `customer_entity_int`; TRUNCATE TABLE `customer_entity_text`; TRUNCATE TABLE `customer_entity_varchar`;
SET FOREIGN_KEY_CHECKS=0; TRUNCATE `sales_order`; TRUNCATE `sales_order_datetime`; TRUNCATE `sales_order_decimal`; TRUNCATE `sales_order_entity`; TRUNCATE `sales_order_entity_datetime`; TRUNCATE `sales_order_entity_decimal`; TRUNCATE `sales_order_entity_int`; TRUNCATE `sales_order_entity_text`; TRUNCATE `sales_order_entity_varchar`; TRUNCATE `sales_order_int`; TRUNCATE `sales_order_text`; TRUNCATE `sales_order_varchar`; TRUNCATE `sales_flat_quote`; TRUNCATE `sales_flat_quote_address`; TRUNCATE `sales_flat_quote_address_item`; TRUNCATE `sales_flat_quote_item`; TRUNCATE `sales_flat_quote_item_option`; TRUNCATE `sales_flat_order_item`; TRUNCATE `sendfriend_log`; TRUNCATE `tag`; TRUNCATE `tag_relation`; TRUNCATE `tag_summary`; TRUNCATE `wishlist`; TRUNCATE `log_quote`; TRUNCATE `report_event`; ALTER TABLE `sales_order` AUTO_INCREMENT=1; ALTER TABLE `sales_order_datetime` AUTO_INCREMENT=1; ALTER TABLE `sales_order_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_datetime` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_int` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_text` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_order_int` AUTO_INCREMENT=1; ALTER TABLE `sales_order_text` AUTO_INCREMENT=1; ALTER TABLE `sales_order_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1; ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1; ALTER TABLE `tag` AUTO_INCREMENT=1; ALTER TABLE `tag_relation` AUTO_INCREMENT=1; ALTER TABLE `tag_summary` AUTO_INCREMENT=1; ALTER TABLE `wishlist` AUTO_INCREMENT=1; ALTER TABLE `log_quote` AUTO_INCREMENT=1; ALTER TABLE `report_event` AUTO_INCREMENT=1;
//For Orders update `eav_entity_store` set `increment_prefix`= 'O' where `entity_type_id`='4' and `store_id`='1'; update `eav_entity_store` set `increment_last_id`= '000000000' where `entity_type_id`='4' and `store_id`='1'; //For Invoice update `eav_entity_store` set `increment_prefix`= 'I' where `entity_type_id`='18' and `store_id`='1'; update `eav_entity_store` set `increment_last_id`= '000000000' where `entity_type_id`='18' and `store_id`='1'; //For shipments update `eav_entity_store` set `increment_prefix`= 'S' where `entity_type_id`='24' and `store_id`='1'; update `eav_entity_store` set `increment_last_id`= '000000000' where `entity_type_id`='24' and `store_id`='1'; //For Customers update `eav_entity_store` set `increment_prefix`= 'C' where `entity_type_id`='1' and `store_id`='1'; update `eav_entity_store` set `increment_last_id`= '000000000' where `entity_type_id`='1' and `store_id`='1'; //For quotes update `eav_entity_store` set `increment_prefix`= 'Q' where `entity_type_id`='11' and `store_id`='1'; update `eav_entity_store` set `increment_last_id`= '000000000' where `entity_type_id`='11' and `store_id`='1';
also you can useYourAttributeCode YourAttributeCode
Update template (catalog/product/list.phtml)instead of YourAttributeCode
YourAttributeCode
$_helper->productAttribute($_product, $_product->myAttribute(), 'my_attribute');
{{block type="catalog/product_list" category_id="123" template="catalog/product/list.phtml"}}where 123 is your category id.
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT); $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate)) ->addAttributeToFilter('news_to_date', array('or'=> array( 0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null'))) ), 'left') ->addAttributeToSort('news_from_date', 'desc') ->addAttributeToSort('created_at', 'desc');
$customer = Mage::getSingleton('customer/session')->getCustomer(); $log = Mage::getModel('log/customer')->load($customer->getId()); $lastVisited = $log->getLastVisitAt();
$customer = Mage::getSingleton('customer/session')->getCustomer(); $log = Mage::getModel('log/customer')->load($customer->getId()); $inctive_time = now() - $log->getLastVisitAt();
$now = Mage::getModel('core/date')->timestamp(time()); echo date('m/d/y h:i:s', $now);
$mainImage = Mage::getBaseDir('media') . DS . 'test' . DS . 'sample.jpg'; $image = new Varien_Image($mainImage); // crop image $image->crop(10, 10, 10, 10); // crop(top, left, $right, $bottom) $image->save(Mage::getBaseDir('media'). DS . 'test' . DS . 'new.jpg');Code Explanation: