This file contains 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 | |
// Reference: app/code/core/Mage/Sales/Model/Service/Quote.php:134 | |
// Set customer info to quote | |
// $store = Mage::getSingleton('core/store')->load($this->getArg('store_id')); | |
// $quote = Mage::getModel('sales/quote')->setStore($store)->load($this->getArg('quote_id')); | |
$convert = Mage::getModel('sales/convert_quote'); | |
$isVirtual = $quote->isVirtual(); | |
// Set shipping method |
This file contains 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 | |
$timer_start = microtime(true); | |
if (!defined('_PS_ADMIN_DIR_')) | |
define('_PS_ADMIN_DIR_', getcwd()); | |
if (!defined('PS_ADMIN_DIR')) | |
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); | |
require(_PS_ADMIN_DIR_ . '/../config/config.inc.php'); | |
require(_PS_ADMIN_DIR_ . '/functions.php'); |
This file contains 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 | |
final class Debug | |
{ | |
public static function log($message, $file = 'system.log') | |
{ | |
try { | |
$logDir = 'log'; | |
$logFile = $logDir . '/' . $file; | |
if (!is_dir($logDir)) { |
This file contains 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 categoryTravel($category, $level) | |
{ | |
$result = new Varien_Data_Collection; | |
if (is_numeric($category)) { | |
$category = Mage::getModel('catalog/category')->load($category); | |
} | |
$this->_categoryTravel($result, $level, $category); | |
return $result; |
This file contains 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
// Change product attribute value | |
public function run() | |
{ | |
// --edit 1-10,color,5 | |
// $default = array( | |
// 'product_ids' => array(1, 10), | |
// 'attribute_code' => 'color', | |
// 'attribute_value' => 5 | |
// ); | |
if (isset($this->_args['edit'])) { |
This file contains 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
// Get new url base current url | |
$url = Mage::getUrl('/*/*', array( | |
'_use_rewrite' => true, | |
'_query' => array( | |
'param1' => 'param1', | |
'param2' => 'param2', | |
'param3' => 'param3', | |
), | |
)); | |
// Get current url |
This file contains 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
// Get attribute object by code | |
Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', 'color'); | |
// Get entity type object by code | |
Mage::getModel('eav/entity_type')->loadByCode('catalog_product'); | |
// =========================================================== | |
public function joinEavTablesIntoCollection($collection, $mainTableForeignKey, $eavType) | |
{ | |
$entityType = Mage::getModel('eav/entity_type')->loadByCode($eavType); | |
$attributes = $entityType->getAttributeCollection(); |
This file contains 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
#Vhost in Apache 2 | |
<VirtualHost *:80> | |
ServerName netshirt.local | |
## Vhost docroot | |
DocumentRoot "/var/www/netshirt" | |
## Directories, there should at least be a declaration for /var/www/netshirt | |
<Directory "/var/www/netshirt"> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All |
This file contains 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
#Add new vhost in Nginx | |
server { | |
listen *:80; | |
server_name example.local www.example.local; | |
index index.html index.htm index.php; | |
access_log /var/log/nginx/example.local.access.log; | |
error_log /var/log/nginx/example.local.error.log; |
This file contains 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
<VirtualHost *:80> | |
ServerName wp.local | |
DocumentRoot "/var/www/wp" | |
<Directory "/var/www/wp"> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
Require all granted | |
</Directory> | |
## Must have | |
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/wp/$1 |
NewerOlder