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 | |
$obj = new Shop_Product(); | |
$obj->select('count(shop_order_items.id) AS "sold"'); | |
$obj->join('shop_products_categories', 'shop_products.id = shop_products_categories.shop_product_id'); | |
$obj->join('shop_order_items', 'shop_products.id = shop_order_items.shop_product_id'); | |
$obj->join('shop_orders', 'shop_order_items.shop_order_id = shop_orders.id'); | |
$best_selling = $obj->where('shop_products_categories.shop_category_id=? AND shop_orders.payment_processed IS NOT NULL', $category->id)->group('shop_products.id')->order('count(shop_order_items.id) DESC')->limit(3)->find_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
window.Phpr.showLoadingIndicator({ | |
loadIndicator: { | |
overlayClass: 'ajax_loading_indicator', | |
zIndex: 9999, | |
html: '<span>Loading...</span>' | |
} | |
}); |
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 | |
class My_Module extends Core_ModuleBase | |
{ | |
protected function createModuleInfo() | |
{ | |
return new Core_ModuleInfo( | |
'Extend model with calculated column', | |
'Adds "Total Orders" and "Total Spend" columns to a customer - useful for marketing purposes', | |
'GreatPotato' |
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
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome')) | |
return true; | |
return false; |
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 | |
public function subscribeEvents() | |
{ | |
Backend::$events->addEvent('shop:onExtendOrderModel', $this, 'extend_order_model'); | |
Backend::$events->addEvent('shop:onExtendOrderForm', $this, 'extend_order_form'); | |
} | |
public function extend_order_model($order, $context) | |
{ |
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 | |
function gp_empty_paragraph_fix($content) { | |
$array = array ( | |
'<p>[' => '[', | |
']</p>' => ']', | |
']<br />' => ']' | |
); | |
$content = strtr($content, $array); | |
return $content; |
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 | |
$pattern = '/\.(icon-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/'; | |
$subject = file_get_contents('css/font-awesome.css'); | |
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER); | |
$icons = array(); | |
echo '<ul>'; |
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 | |
$obj = new Shop_CurrencySettings; | |
$obj = $obj::get(); | |
$currency = $obj->sign; |
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 | |
public function subscribeEvents() | |
{ | |
Backend::$events->addEvent('backend:onControllerReady', $this, 'on_backend_controller_ready'); | |
} | |
public function on_backend_controller_ready($controller) | |
{ | |
$controller->list_search_fields[] = 'x_custom_column'; |
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
window.Phpr.response.popupError = window.LS.response.popupError = function(message) { | |
console.log(message); | |
} |