Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/units/orders/orders_tag_processor.php
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | |||||
{ | { | ||||
$object = $this->Application->recallObject('orditems'); | $object = $this->Application->recallObject('orditems'); | ||||
return $object->GetDBField('ProductId') > 0; | return $object->GetDBField('ProductId') > 0; | ||||
} | } | ||||
function PrintCart($params) | function PrintCart($params) | ||||
{ | { | ||||
$o = ''; | $o = ''; | ||||
$o_items = ''; | |||||
if ( $this->orderExists($params) ) { | |||||
$params['render_as'] = $params['item_render_as']; | $params['render_as'] = $params['item_render_as']; | ||||
$tag_params = array_merge($params, Array ('per_page' => -1)); | $tag_params = array_merge($params, array('per_page' => -1)); | ||||
$o_items = $this->Application->ProcessParsedTag(rtrim('orditems.' . $this->Special, '.'), 'PrintList', $tag_params); | $o_items = $this->Application->ProcessParsedTag( | ||||
rtrim('orditems.' . $this->Special, '.'), | |||||
'PrintList', | |||||
$tag_params | |||||
); | |||||
} | |||||
if ( $o_items ) { | if ( $o_items ) { | ||||
if ( isset($params['header_render_as']) ) { | if ( isset($params['header_render_as']) ) { | ||||
$cart_params = array ('name' => $params['header_render_as']); | $cart_params = array ('name' => $params['header_render_as']); | ||||
$o .= $this->Application->ParseBlock($cart_params); | $o .= $this->Application->ParseBlock($cart_params); | ||||
} | } | ||||
$o .= $o_items; | $o .= $o_items; | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | |||||
$object->Query(); | $object->Query(); | ||||
return array_sum($object->GetCol('Quantity')); // $object->GetRecordsCount(); | return array_sum($object->GetCol('Quantity')); // $object->GetRecordsCount(); | ||||
} | } | ||||
function CartNotEmpty($params) | function CartNotEmpty($params) | ||||
{ | { | ||||
$object = $this->getObject($params); | if ( !$this->orderExists($params) ) { | ||||
if ($object->GetDBField('Status') != ORDER_STATUS_INCOMPLETE || $object->GetID() == FAKE_ORDER_ID) { | |||||
return 0; | return 0; | ||||
} | } | ||||
$order_id = $this->Application->RecallVar('ord_id'); | $order_id = $this->Application->RecallVar('ord_id'); | ||||
if ($order_id) { | if ($order_id) { | ||||
$sql = 'SELECT COUNT(*) | $sql = 'SELECT COUNT(*) | ||||
FROM ' . TABLE_PREFIX . 'OrderItems | FROM ' . TABLE_PREFIX . 'OrderItems | ||||
WHERE OrderId = ' . $order_id; | WHERE OrderId = ' . $order_id; | ||||
return $this->Conn->GetOne($sql); | return $this->Conn->GetOne($sql); | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
/** | |||||
* Checks order is exists. | |||||
* | |||||
* @param array $params Tag params. | |||||
* | |||||
* @return boolean | |||||
*/ | |||||
protected function orderExists(array $params) | |||||
{ | |||||
$object = $this->getObject($params); | |||||
if ( $object->GetDBField('Status') != ORDER_STATUS_INCOMPLETE || $object->GetID() == FAKE_ORDER_ID ) { | |||||
return false; | |||||
} | |||||
return true; | |||||
} | |||||
function CartIsEmpty($params) | function CartIsEmpty($params) | ||||
{ | { | ||||
return $this->CartNotEmpty($params) ? false : true; | return $this->CartNotEmpty($params) ? false : true; | ||||
} | } | ||||
function CartHasBackorders($params = Array ()) | function CartHasBackorders($params = Array ()) | ||||
{ | { | ||||
$object = $this->getObject($params); | $object = $this->getObject($params); | ||||
▲ Show 20 Lines • Show All 1463 Lines • Show Last 20 Lines |