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
class Dg_Pricerulesextended_Helper_Data extends Mage_Core_Helper_Abstract { | |
private function generatePromoCode($length = null) { | |
$rndId = crypt(uniqid(rand(),1)); | |
$rndId = strip_tags(stripslashes($rndId)); | |
$rndId = str_replace(array(".", "$"),"",$rndId); | |
$rndId = strrev(str_replace("/","",$rndId)); | |
if (!is_null($rndId)){ | |
return strtoupper(substr($rndId, 0, $length)); | |
} |
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
SELECT brand, name, style, color, size, season, initial_qty, current_qty, sell_through, price, avg_price, cost, avg_cost FROM ( | |
SELECT | |
initial_qty.sm_product_id, brand, name, style, color, size, season, initial_qty.qty AS initial_qty, current_qty.qty AS current_qty, ROUND(IF(initial_qty.qty < current_qty.qty, 0, current_qty.qty / initial_qty.qty), 2) AS sell_through, ROUND(price,2) AS price, ROUND(cost,2) AS cost, | |
(SELECT ROUND(AVG(price),2) FROM sales_flat_order_item WHERE price != 0 AND sku = initial_qty.sku) AS avg_price, | |
(SELECT ROUND(AVG((pop_price_ht * (IF(pop_discount > 0, pop_discount, 100) / 100))),2) FROM purchase_order_product WHERE pop_product_id = initial_qty.sm_product_id) AS avg_cost | |
FROM ( | |
SELECT a.sm_product_id, b.sku, b.manufacturer_value AS brand, b.name, b.vendor_product_id AS style, b.image_label AS color, b.choose_size_value AS size, b.season, SUM(IF(sm_source_stock = 1, -sm_qty, sm_qty)) AS qty, price, cost | |
FROM stock_movement AS a | |
INNER JOIN catalog_product_flat_1 AS b O |
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 | |
/** | |
* This new CLI script refreshes stock status, just do 'php erp.php refreshstockstatus' in /shell | |
* Optimized for minimal memory usage with one fix to the core BoostShop ERP code, which is the addition | |
* of $this->_product->clearInstance() to the end of MDN_SalesOrderPlanning_Model_ProductAvailabilityStatus::Refresh | |
**/ | |
#/shell/erp.php | |
require_once 'abstract.php'; | |
class Mage_Shell_Erp extends Mage_Shell_Abstract |
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 'abstract.php'; | |
class Mage_Shell_Pricerules extends Mage_Shell_Abstract | |
{ | |
public function run() | |
{ | |
ini_set('memory_limit', '1024M'); | |
$this->db = Mage::getSingleton('core/resource')->getConnection('core_read'); |
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 | |
/* | |
==New BSD License== | |
Copyright (c) 2013, Drew Gillson | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: |
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 | |
/* | |
==New BSD License== | |
Copyright (c) 2013, Drew Gillson | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
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 | |
class Lot_Common_Helper_Cli_Erp extends Lot_Common_Helper_Cli_Data { | |
public function refreshStockStatusAsync($entity_ids) { | |
foreach ($entity_ids as $entity_id) { | |
try { | |
Mage::helper('SalesOrderPlanning/ProductAvailabilityStatus')->RefreshForOneProduct($entity_id); | |
Mage::helper('AdvancedStock/Product_Base')->updateStocksFromProductId($entity_id); | |
Mage::helper('purchase/Product')->updateProductWaitingForDeliveryQty($entity_id); | |
Mage::helper('purchase/Product')->updateProductDeliveryDate($entity_id); |
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 | |
$db = Mage::getSingleton('core/resource')->getConnection('core_read'); | |
$rows = $db->fetchAll("SELECT entity_id FROM catalog_product_entity WHERE type_id = 'simple'"); | |
foreach ($rows as $row) { | |
Mage::helper('SalesOrderPlanning/ProductAvailabilityStatus')->RefreshForOneProduct($row['entity_id']); | |
Mage::helper('AdvancedStock/Product_Base')->updateStocksFromProductId($row['entity_id']); | |
Mage::helper('purchase/Product')->updateProductWaitingForDeliveryQty($row['entity_id']); | |
Mage::helper('purchase/Product')->updateProductDeliveryDate($row['entity_id']); | |
} |
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
oauth \ | |
--method PUT \ | |
--consumer-key v3b7p1yn29q0378ybk9w5d7hrsmiifpf \ | |
--consumer-secret q91boucyygushav4ce4x07sohvpsynlg \ | |
--token abe2y68hu5y43qr9eghwyttyrf0yhowy \ | |
--secret 6gbzpn4uiok1k5ml8963nkz43l67ynom \ | |
--uri http://yourdomain.com/api/rest/products/522909 \ | |
debug | |
Method: PUT |
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 | |
/** | |
* Example of simple product POST using Admin account via Magento REST API. OAuth authorization is used | |
*/ | |
$callbackUrl = "http://yourdomain.com/magento-create-product-rest-api.php"; // the URL of this file | |
$temporaryCredentialsRequestUrl = "http://yourdomain.com/oauth/initiate?oauth_callback=" . urlencode($callbackUrl); | |
$adminAuthorizationUrl = 'http://yourdomain.com/admin/oauth_authorize'; | |
$accessTokenRequestUrl = 'http://yourdomain.com/oauth/token'; | |
$apiUrl = 'http://yourdomain.com/api/rest'; | |
$consumerKey = 'v3b7p1yn29q0378ybk9w5d7hrsmiifpf'; |