Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1203550
D214.id508.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Nov 3, 3:06 PM
Size
2 KB
Mime Type
text/x-diff
Expires
Tue, Nov 4, 3:06 PM (15 h, 4 m)
Engine
blob
Format
Raw Data
Handle
785276
Attached To
D214: MINC-149 - Check, that order really exists in "ord_PrintCart" tag
D214.id508.diff
View Options
Index: modules/in-commerce/units/orders/orders_tag_processor.php
===================================================================
--- modules/in-commerce/units/orders/orders_tag_processor.php
+++ modules/in-commerce/units/orders/orders_tag_processor.php
@@ -98,11 +98,18 @@
function PrintCart($params)
{
$o = '';
+ $o_items = '';
- $params['render_as'] = $params['item_render_as'];
- $tag_params = array_merge($params, Array ('per_page' => -1));
-
- $o_items = $this->Application->ProcessParsedTag(rtrim('orditems.' . $this->Special, '.'), 'PrintList', $tag_params);
+ if ( $this->orderExists($params) ) {
+ $params['render_as'] = $params['item_render_as'];
+ $tag_params = array_merge($params, array('per_page' => -1));
+
+ $o_items = $this->Application->ProcessParsedTag(
+ rtrim('orditems.' . $this->Special, '.'),
+ 'PrintList',
+ $tag_params
+ );
+ }
if ( $o_items ) {
if ( isset($params['header_render_as']) ) {
@@ -192,9 +199,7 @@
function CartNotEmpty($params)
{
- $object = $this->getObject($params);
-
- if ($object->GetDBField('Status') != ORDER_STATUS_INCOMPLETE || $object->GetID() == FAKE_ORDER_ID) {
+ if ( !$this->orderExists($params) ) {
return 0;
}
@@ -209,6 +214,24 @@
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)
{
return $this->CartNotEmpty($params) ? false : true;
Index: themes/advanced/in-commerce/checkout/shop_cart.tpl
===================================================================
--- themes/advanced/in-commerce/checkout/shop_cart.tpl
+++ themes/advanced/in-commerce/checkout/shop_cart.tpl
@@ -6,7 +6,7 @@
<!--## PAGE TITLE ELEMENT ##-->
<inp2:m_DefineElement name="page_title">
- <inp2:m_Phrase label="lu_title_ShoppingCart" no_editing="1"/><inp2:m_if check="orditems_TotalRecords"> (<inp2:orditems_TotalRecords/>)</inp2:m_if>
+ <inp2:m_Phrase label="lu_title_ShoppingCart" no_editing="1"/><inp2:m_if check="ord_CartNotEmpty"> (<inp2:orditems_TotalRecords/>)</inp2:m_if>
</inp2:m_DefineElement>
<!--## //PAGE TITLE ELEMENT ##-->
@@ -38,7 +38,7 @@
<div class="movable-element">
<inp2:m_RenderElement design="content_box">
<inp2:m_Capture to_var="header">
- <inp2:m_Phrase label="lu_title_ShoppingCart"/><inp2:m_if check="orditems_TotalRecords"> (<inp2:orditems_TotalRecords/>)</inp2:m_if>
+ <inp2:m_Phrase label="lu_title_ShoppingCart"/><inp2:m_if check="ord_CartNotEmpty"> (<inp2:orditems_TotalRecords/>)</inp2:m_if>
</inp2:m_Capture>
<form method="post" action="<inp2:m_FormAction />">
Event Timeline
Log In to Comment