Child pages
  • [in-commerce] Notice on empty Shopping Cart page [5.2.2-B1]
Skip to end of metadata
Go to start of metadata

The <inp2:ord_PrintCart .../> tag, used on Shopping Cart page, produces following notice, when shopping cart is empty:

Parent ID not found (prefix: "ord"; sub-prefix: "orditems")

The "OrderTagProcessor::PrintCart" method (powers above mentioned tag) uses the "orditems_PrintList" tag (powered by "OrderItemsTagProcessor::PrintList" method) which initializes "orditems" unit object. But "orditems" unit is a subitem of "ord" unit and therefore requires "ord" unit object for initialization. While shopping cart is empty we have no "ord" unit object stores in class factory and a notice is created.

modules/in-commerce/units/orders/orders_tag_processor.php
function PrintCart($params)
{
   $o = '';

   $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']) ) {
         $cart_params = array ('name' => $params['header_render_as']);
         $o .= $this->Application->ParseBlock($cart_params);
      }

      $o .= $o_items;

      if ( isset($params['footer_render_as']) ) {
         $cart_params = array ('name' => $params['footer_render_as']);
         $o .= $this->Application->ParseBlock($cart_params);
      }
   }
   elseif ( isset($params['empty_cart_render_as']) ) {
      $cart_params = array ('name' => $params['empty_cart_render_as']);
      $o = $this->Application->ParseBlock($cart_params);
   }

   return $o;
}

Solution

Check order really exists before calling "orditems_PrintList" tag. We can use code fragment from "ord_CartNotEmpty" tag:

modules/in-commerce/units/orders/orders_tag_processor.php
if ($object->GetDBField('Status') != ORDER_STATUS_INCOMPLETE || $object->GetID() == FAKE_ORDER_ID) {

Related Tasks

MINC-149 - Getting issue details... STATUS