This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // USAGE http://www.site.com/dev/updategroupprice.php?price=14.95&sku=ABC152X | |
| require_once '../app/Mage.php'; | |
| umask(0); | |
| //Mage::app('admin'); | |
| Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
| $sku = $_GET['sku']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. How to add a Magento CSS file to frontend | |
| 1.1. Create (Copy) a CSS file (or a CSS folder) in folder skin/frontend/default/default/css/ or skin/frontend/base/default/css/ | |
| Example: skin/frontend/default/default/css/magestore/mycss.css | |
| Or: skin/frontend/default/default/css/mycustom.css | |
| Or: skin/frontend/base/default/css/mycustom.css. | |
| 1.2. Add a CSS file from layout file | |
| In the following examples, system firstly finds the declared magento CSS file in folder skin/frontend/default/default/css. If it can’t find in this folder, system automatically finds in folder skin/frontend/base/default/css. If the system fails to find in both above folders, it will report error or skip. | |
| For comprehensive system (always add when layout files have not been loaded) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //use: | |
| iterator($n); | |
| function iterator($arr){ | |
| foreach($arr as $key => $val){ | |
| if(is_array($val))iterator($val); | |
| echo '<p>key: '.$key.' | value: '.$val.'</p>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function uppercaseAction() | |
| { | |
| // get customer collection | |
| $customers = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect(array('firstname'), 'inner'); | |
| // call iterator walk method with collection query string and callback method as parameters | |
| Mage::getSingleton('core/resource_iterator')->walk($customers->getSelect(), array(array($this, 'customerCallback'))); | |
| } | |
| // callback method | |
| public function customerCallback($args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // API Configuration | |
| $this->APIUrl= "http://yourdomain.com/index.php/api/soap/?wsdl"; | |
| $this->APIUser="APIUser"; | |
| $this->APIKey= "APIKey"; | |
| function addAPIImages($product_id){ | |
| $sql ="SELECT * FROM YourDatabaseTable WHERE ProductID = $product_id"; | |
| $resultat=mysql_query($sql) or die('SQL error:'.mysql_error()); | |
| while ($row = mysql_fetch_array($resultat)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once 'app/Mage.php'; | |
| umask(0); | |
| ini_set("memory_limit","1024M"); | |
| //$_SERVER['SERVER_PORT']='443'; | |
| Mage::app(); | |
| $profileId = 7; //put your profile id here | |
| $logFileName= "import.log"; | |
| $recordCount = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Check product's status. | |
| function getProductInfo($product_id){ | |
| $this->APIUrl= "http://yourdomain.com/index.php/api/soap/?wsdl"; | |
| $this->APIUser="APIUser"; | |
| $this->APIKey= "APIKey"; | |
| $proxy = new SoapClient($this->APIUrl); | |
| $sessionId = $proxy->login($this->APIUser, $this->APIKey); | |
| $exists = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $order = Mage::getModel('sales/order')->load(entity_id); | |
| $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment()) | |
| ->setIsSecureMode(true); | |
| $channelOrderId = $paymentInfo->getChannelOrderId(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Issue : | |
| How to point a parked domain to a sub-directory of the main domain without any change in the URL ? | |
| Fix : | |
| This is like making the parked domain function like an add-on domain. | |
| Assuming that the parked domain name is abc.com and the corresponding folder under the main domain is ‘abc’ .This can be achieved by putting the following in the .htaccess file for the main domain : | |
| RewriteEngine On |