17 require_once SQ_PACKAGES_PATH.
'/cms/form/form_submission/form_submission.inc';
18 require_once SQ_PACKAGES_PATH.
'/ecommerce/orders/order_line/order_line.inc';
45 $this->_ser_attrs =
true;
46 $this->
Asset($assetid);
60 $order_links = parent::_getAllowedLinks();
61 $order_links[SQ_LINK_TYPE_3][
'order_line'] = Array(
'card' =>
'M');
78 foreach($lines as $assetid) {
79 $line =& $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
80 $total += $line->attr(
'quantity') * $line->attr(
'price');
99 foreach($lines as $assetid) {
100 $line =& $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
101 $count += $line->attr(
'quantity');
118 return count($lines);
134 $links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($this->
id, SQ_LINK_TYPE_3,
'order_line',
false);
138 foreach($links as $link) {
139 $assetids[] = $link[
'minorid'];
162 $new_order_line->setAttrValue(
'quantity', $quantity);
163 $new_order_line->setAttrValue(
'price', $price);
164 $new_order_line->setAttrValue(
'product_assetid', $product_assetid);
167 $link = array(
'asset' => &$this,
'link_type' => SQ_LINK_TYPE_3,
'is_dependant' => 1,
'is_exclusive' => 1);
170 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
171 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
172 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
173 $success = $new_order_line->create($link);
174 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
177 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
179 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
182 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
200 $ecommerce_checkout_id = $cart_items->attr(
'ecommerce_checkout_id');
202 foreach($_SESSION[
'sq_cart_contents'][$ecommerce_checkout_id] as $product_assetid => $product_info) {
203 $this->
createLine($product_assetid, $product_info[
'price'], $product_info[
'quantity']);
208 unset($_SESSION[
'sq_cart_contents'][$ecommerce_checkout_id]);