Skip to content

Commit

Permalink
Merge remote branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ling adam committed May 14, 2018
2 parents f0986b9 + 51e5cc7 commit 7fbe012
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ public function render(Varien_Object $row)
{
$actions = $this->getColumn()->getActions();
$field = $this->getColumn()->getField();
$url = 'https://www.bellecat.com/en/catalog/product/view/id/'.$row->getData($field);
$product_id = $row->getData($field);

$adapter = Mage::getSingleton('core/resource')->getConnection('core_write');
$ur_result = $adapter->query("SELECT * FROM `core_url_rewrite` WHERE product_id='".$product_id."' AND category_id IS NULL LIMIT 1");
$url = $ur_result->fetch();
$url = 'https://www.bellecat.com/en/'.(isset($url['request_path'])?$url['request_path']:'');
//$url = 'https://www.bellecat.com/en/catalog/product/view/id/'.$row->getData($field);

return '<a target="_blank" href="'.$url.'">'.$this->getColumn()->getHeader().'</a>';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ protected function _prepareCollection()
->columns("SUM(IF(order.status='complete' OR order.status='processing',oi.qty_ordered,0)) as num")
->joinLeft('sales_flat_order_item as oi','oi.product_id=e.entity_id','')
->joinLeft('sales_flat_order AS order',"oi.order_id=order.entity_id and (order.status='complete' or order.status='processing')",'')
->joinLeft("cataloginventory_stock_status_idx as stock","stock.product_id=oi.product_id and stock.website_id=1",'ROUND(9999-stock.qty) as stock_num')
//->where('order.created_at>=?',array('from'=>$from))
//->where('order.created_at<?',array('to'=>$to))
//->where("order.status='complete' OR order.status='processing'")
Expand Down Expand Up @@ -139,6 +140,12 @@ protected function _prepareColumns()
'type' => 'number'
));

$this->addColumn('stock', array(
'header' => Mage::helper('customer')->__('Stock'),
'index' => 'stock_num',
'type' => 'number'
));

$this->addColumn('created_at', array(
'header' => Mage::helper('customer')->__('Created At'),
'index' => 'created_at',
Expand Down

0 comments on commit 7fbe012

Please sign in to comment.