Page MenuHomeIn-Portal Phabricator

in-commerce
No OneTemporary

File Metadata

Created
Sun, Apr 20, 10:31 AM

in-commerce

This file is larger than 256 KB, so syntax highlighting was skipped.
Index: branches/5.3.x/units/gateways/gw_classes/google_checkout.php
===================================================================
--- branches/5.3.x/units/gateways/gw_classes/google_checkout.php (revision 15898)
+++ branches/5.3.x/units/gateways/gw_classes/google_checkout.php (revision 15899)
@@ -1,940 +1,940 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
require_once GW_CLASS_PATH.'/gw_base.php';
$class_name = 'kGWGoogleCheckout'; // for automatic installation
class kGWGoogleCheckout extends kGWBase
{
var $gwParams = Array ();
function InstallData()
{
$data = array(
'Gateway' => Array('Name' => 'Google Checkout', 'ClassName' => 'kGWGoogleCheckout', 'ClassFile' => 'google_checkout.php', 'RequireCCFields' => 0),
'ConfigFields' => Array(
'submit_url' => Array('Name' => 'Submit URL', 'Type' => 'text', 'ValueList' => '', 'Default' => 'https://checkout.google.com/api/checkout/v2'),
'merchant_id' => Array('Name' => 'Google merchant ID', 'Type' => 'text', 'ValueList' => '', 'Default' => ''),
'merchant_key' => Array('Name' => 'Google merchant key', 'Type' => 'text', 'ValueList' => '', 'Default' => ''),
'shipping_control' => Array('Name' => 'Shipping Control', 'Type' => 'select', 'ValueList' => '3=la_CreditDirect,4=la_CreditPreAuthorize', 'Default' => 3),
)
);
return $data;
}
/**
* Returns payment form submit url
*
* @param Array $gw_params gateway params from payment type config
* @return string
*/
function getFormAction($gw_params)
{
return $gw_params['submit_url'].'/checkout/Merchant/'.$gw_params['merchant_id'];
}
/**
* Processed input data and convets it to fields understandable by gateway
*
* @param Array $item_data current order fields
* @param Array $tag_params additional params for gateway passed through tag
* @param Array $gw_params gateway params from payment type config
* @return Array
*/
function getHiddenFields($item_data, $tag_params, $gw_params)
{
$ret = Array();
$this->gwParams = $gw_params;
$cart_xml = $this->getCartXML($item_data);
$ret['cart'] = base64_encode($cart_xml);
$ret['signature'] = base64_encode( $this->CalcHmacSha1($cart_xml, $gw_params) );
return $ret;
}
function getCartXML($cart_fields)
{
// 1. prepare shopping cart content
$sql = 'SELECT *
FROM '.TABLE_PREFIX.'OrderItems oi
LEFT JOIN '.TABLE_PREFIX.'Products p ON p.ProductId = oi.ProductId
WHERE oi.OrderId = '.$cart_fields['OrderId'];
$order_items = $this->Conn->Query($sql);
$ml_formatter = $this->Application->recallObject('kMultiLanguage');
/* @var $ml_formatter kMultiLanguage */
$cart_xml = Array ();
foreach ($order_items as $order_item) {
$cart_xml[] = ' <item>
- <item-name>'.htmlspecialchars($order_item['ProductName'], null, CHARSET).'</item-name>
- <item-description>'.htmlspecialchars($order_item[$ml_formatter->LangFieldName('DescriptionExcerpt')], null, CHARSET).'</item-description>'.
+ <item-name>'.kUtil::escape($order_item['ProductName'], kUtil::ESCAPE_HTML).'</item-name>
+ <item-description>'.kUtil::escape($order_item[$ml_formatter->LangFieldName('DescriptionExcerpt')], kUtil::ESCAPE_HTML).'</item-description>'.
$this->getPriceXML('unit-price', $order_item['Price']).'
<quantity>'.$order_item['Quantity'].'</quantity>
</item>';
}
$cart_xml = '<items>'.implode("\n", $cart_xml).'</items>';
// 2. add order identification info (for google checkout notification)
$cart_xml .= ' <merchant-private-data>
<session_id>'.$this->Application->GetSID().'</session_id>
<order_id>'.$cart_fields['OrderId'].'</order_id>
</merchant-private-data>';
// 3. add all shipping types (with no costs)
$sql = 'SELECT Name
FROM '.TABLE_PREFIX.'ShippingType
WHERE Status = '.STATUS_ACTIVE;
$shipping_types = $this->Conn->GetCol($sql);
$shipping_xml = '';
foreach ($shipping_types as $shipping_name) {
- $shipping_xml .= ' <merchant-calculated-shipping name="'.htmlspecialchars($shipping_name, null, CHARSET).'">
+ $shipping_xml .= ' <merchant-calculated-shipping name="'.kUtil::escape($shipping_name, kUtil::ESCAPE_HTML).'">
<price currency="USD">0.00</price>
</merchant-calculated-shipping>';
}
$use_ssl = substr($this->gwParams['submit_url'], 0, 8) == 'https://' ? true : null;
$shipping_url = $this->getNotificationUrl('units/gateways/gw_classes/notify_scripts/google_checkout_shippings.php', $use_ssl);
$shipping_xml = '<merchant-checkout-flow-support>
<shipping-methods>'.$shipping_xml.'</shipping-methods>
<merchant-calculations>
<merchant-calculations-url>'.$shipping_url.'</merchant-calculations-url>
</merchant-calculations>
</merchant-checkout-flow-support>';
$xml = '<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
<shopping-cart>'.$cart_xml.'</shopping-cart>
<checkout-flow-support>'.$shipping_xml.'</checkout-flow-support>
</checkout-shopping-cart>';
return $xml;
}
/**
* Returns price formatted as xml tag
*
* @param string $tag_name
* @param float $price
* @return string
*/
function getPriceXML($tag_name, $price)
{
$currency = $this->Application->RecallVar('curr_iso');
return '<'.$tag_name.' currency="'.$currency.'">'.sprintf('%.2f', $price).'</'.$tag_name.'>';
}
/**
* Calculates the cart's hmac-sha1 signature, this allows google to verify
* that the cart hasn't been tampered by a third-party.
*
* {@link http://code.google.com/apis/checkout/developer/index.html#create_signature}
*
* @param string $data the cart's xml
* @return string the cart's signature (in binary format)
*/
function CalcHmacSha1($data, $gw_params) {
$key = $gw_params['merchant_key'];
$blocksize = 64;
$hashfunc = 'sha1';
if (mb_strlen($key) > $blocksize) {
$key = pack('H*', $hashfunc($key));
}
$key = str_pad($key, $blocksize, chr(0x00));
$ipad = str_repeat(chr(0x36), $blocksize);
$opad = str_repeat(chr(0x5c), $blocksize);
$hmac = pack(
'H*', $hashfunc(
($key^$opad).pack(
'H*', $hashfunc(
($key^$ipad).$data
)
)
)
);
return $hmac;
}
/**
* Returns XML request, that GoogleCheckout posts to notification / shipping calculation scripts
*
* @return string
*/
function getRequestXML()
{
$xml_data = $GLOBALS['HTTP_RAW_POST_DATA'];
if ( $this->Application->isDebugMode() ) {
$this->toLog($xml_data, 'xml_request.html');
}
return $xml_data;
// for debugging
/*return '<order-state-change-notification xmlns="http://checkout.google.com/schema/2"
serial-number="c821426e-7caa-4d51-9b2e-48ef7ecd6423">
<google-order-number>434532759516557</google-order-number>
<new-financial-order-state>CHARGEABLE</new-financial-order-state>
<new-fulfillment-order-state>NEW</new-fulfillment-order-state>
<previous-financial-order-state>REVIEWING</previous-financial-order-state>
<previous-fulfillment-order-state>NEW</previous-fulfillment-order-state>
<timestamp>2007-03-19T15:06:29.051Z</timestamp>
</order-state-change-notification>';*/
}
/**
* Processes notifications from google checkout
*
* @param Array $gw_params
* @return int
*/
function processNotification($gw_params)
{
// parse xml & get order_id from there, like sella pay
$this->gwParams = $gw_params;
$xml_helper = $this->Application->recallObject('kXMLHelper');
/* @var $xml_helper kXMLHelper */
$root_node =& $xml_helper->Parse( $this->getRequestXML() );
/* @var $root_node kXMLNode */
$this->Application->XMLHeader();
define('DBG_SKIP_REPORTING', 1);
$order_approvable = false;
switch ($root_node->Name) {
case 'MERCHANT-CALCULATION-CALLBACK':
$xml_responce = $this->getShippingXML($root_node);
break;
case 'NEW-ORDER-NOTIFICATION':
case 'RISK-INFORMATION-NOTIFICATION':
case 'ORDER-STATE-CHANGE-NOTIFICATION':
// http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Notification_API.html#new_order_notifications
list ($order_approvable, $xml_responce) = $this->getNotificationResponceXML($root_node);
break;
}
echo $xml_responce;
if ( $this->Application->isDebugMode() ) {
$this->toLog($xml_responce, 'xml_responce.html');
}
return $order_approvable ? 1 : 0;
}
/**
* Writes XML requests and responces to a file
*
* @param string $xml_data
* @param string $xml_file
*/
function toLog($xml_data, $xml_file)
{
$fp = fopen( (defined('RESTRICTED') ? RESTRICTED : FULL_PATH) . '/' . $xml_file, 'a' );
fwrite($fp, '--- ' . adodb_date('Y-m-d H:i:s') . ' ---' . "\n" . $xml_data);
fclose($fp);
}
/**
* Processes notification
*
* @param kXMLNode $root_node
*/
function getNotificationResponceXML(&$root_node)
{
// we can get notification type by "$root_node->Name"
$order_approvable = false;
switch ($root_node->Name) {
case 'NEW-ORDER-NOTIFICATION':
$order_approvable = $this->processNewOrderNotification($root_node);
break;
case 'RISK-INFORMATION-NOTIFICATION':
$order_approvable = $this->processRiskInformationNotification($root_node);
break;
case 'ORDER-STATE-CHANGE-NOTIFICATION':
$order_approvable = $this->processOrderStateChangeNotification($root_node);
break;
}
// !!! globally set order id, so gw_responce.php will not fail in setting TransactionStatus
// 1. receive new order notification
// put address & payment type in our order using id found in merchant-private-data (Make order status: Incomplete)
// 2. receive risk information
// don't know what to do, just mark order some how (Make order status: Incomplete)
// 3. receive status change notification to CHARGEABLE (Make order status: Pending)
// only mark order status
// 4. admin approves order
// make api call, that changes order state (fulfillment-order-state) to PROCESSING or DELIVERED (see manual)
// 5. admin declines order
// make api call, that changes order state (fulfillment-order-state) to WILL_NOT_DELIVER
// Before you ship the items in an order, you should ensure that you have already received the new order notification for the order,
// the risk information notification for the order and an order state change notification informing you that the order's financial
// state has been updated to CHARGEABLE
return Array ($order_approvable, '<notification-acknowledgment xmlns="http://checkout.google.com/schema/2" serial-number="'.$root_node->Attributes['SERIAL-NUMBER'].'" />');
}
/**
* Returns shipping calculations and places part of shipping address into order (1st step)
*
* http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Merchant_Calculations_API.html#Returning_Merchant_Calculation_Results
*
* @param kXMLNode $node
* @return string
*/
function getShippingXML(&$root_node)
{
// 1. extract data from xml
$search_nodes = Array (
'SHOPPING-CART:MERCHANT-PRIVATE-DATA',
'CALCULATE:ADDRESSES:ANONYMOUS-ADDRESS',
'CALCULATE:SHIPPING',
);
foreach ($search_nodes as $search_string) {
$found_node =& $root_node;
/* @var $found_node kXMLNode */
$search_string = explode(':', $search_string);
foreach ($search_string as $search_node) {
$found_node =& $found_node->FindChild($search_node);
}
$node_data = Array ();
$sub_node =& $found_node->firstChild;
/* @var $sub_node kXMLNode */
do {
if ($found_node->Name == 'SHIPPING') {
$node_data[] = $sub_node->Attributes['NAME'];
}
else {
$node_data[$sub_node->Name] = $sub_node->Data;
}
} while ( ($sub_node =& $sub_node->NextSibling()) );
switch ($found_node->Name) {
case 'MERCHANT-PRIVATE-DATA':
$order_id = $node_data['ORDER_ID'];
$session_id = $node_data['SESSION_ID'];
break;
case 'ANONYMOUS-ADDRESS':
$address_info = $node_data;
$address_id = $found_node->Attributes['ID'];
break;
case 'SHIPPING':
$process_shippings = $node_data;
break;
}
}
// 2. update shipping address in order
$order = $this->Application->recallObject('ord', null, Array ('skip_autoload' => true));
/* @var $order OrdersItem */
$order->Load($order_id);
$shipping_address = Array (
'ShippingCity' => $address_info['CITY'],
'ShippingState' => $address_info['REGION'],
'ShippingZip' => $address_info['POSTAL-CODE'],
);
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
$shipping_address['ShippingCountry'] = $cs_helper->getCountryIso($address_info['COUNTRY-CODE'], true);
$order->SetDBFieldsFromHash($shipping_address);
$order->Update();
// 3. get shipping rates based on given address
$shipping_types_xml = '';
$shipping_types = $this->getOrderShippings($order);
// add available shipping types
foreach ($shipping_types as $shipping_type) {
$shipping_name = $shipping_type['ShippingName'];
$processable_shipping_index = array_search($shipping_name, $process_shippings);
if ($processable_shipping_index !== false) {
- $shipping_types_xml .= '<result shipping-name="'.htmlspecialchars($shipping_name, null, CHARSET).'" address-id="'.$address_id.'">
+ $shipping_types_xml .= '<result shipping-name="'.kUtil::escape($shipping_name, kUtil::ESCAPE_HTML).'" address-id="'.$address_id.'">
<shipping-rate currency="USD">'.sprintf('%01.2f', $shipping_type['TotalCost']).'</shipping-rate>
<shippable>true</shippable>
</result>';
// remove available shipping type from processable list
unset($process_shippings[$processable_shipping_index]);
}
}
// add unavailable shipping types
foreach ($process_shippings as $shipping_name) {
- $shipping_types_xml .= '<result shipping-name="'.htmlspecialchars($shipping_name, null, CHARSET).'" address-id="'.$address_id.'">
+ $shipping_types_xml .= '<result shipping-name="'.kUtil::escape($shipping_name, kUtil::ESCAPE_HTML).'" address-id="'.$address_id.'">
<shipping-rate currency="USD">0.00</shipping-rate>
<shippable>false</shippable>
</result>';
}
$shipping_types_xml = '<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
<results>'.$shipping_types_xml.'</results>
</merchant-calculation-results>';
return $shipping_types_xml;
}
/**
* Places all information from google checkout into order (2nd step)
*
* @param kXMLNode $root_node
*/
function processNewOrderNotification(&$root_node)
{
// 1. extract data from xml
$search_nodes = Array (
'SHOPPING-CART:MERCHANT-PRIVATE-DATA',
'ORDER-ADJUSTMENT:SHIPPING:MERCHANT-CALCULATED-SHIPPING-ADJUSTMENT',
'BUYER-ID',
'GOOGLE-ORDER-NUMBER',
'BUYER-SHIPPING-ADDRESS',
'BUYER-BILLING-ADDRESS',
);
$user_address = Array ();
foreach ($search_nodes as $search_string) {
$found_node =& $root_node;
/* @var $found_node kXMLNode */
$search_string = explode(':', $search_string);
foreach ($search_string as $search_node) {
$found_node =& $found_node->FindChild($search_node);
}
$node_data = Array ();
if ($found_node->Children) {
$sub_node =& $found_node->firstChild;
/* @var $sub_node kXMLNode */
do {
$node_data[$sub_node->Name] = $sub_node->Data;
} while ( ($sub_node =& $sub_node->NextSibling()) );
}
switch ($found_node->Name) {
case 'MERCHANT-PRIVATE-DATA':
$order_id = $node_data['ORDER_ID'];
$session_id = $node_data['SESSION_ID'];
break;
case 'MERCHANT-CALCULATED-SHIPPING-ADJUSTMENT':
$shpipping_info = $node_data;
break;
case 'BUYER-ID':
$buyer_id = $found_node->Data;
break;
case 'GOOGLE-ORDER-NUMBER':
$google_order_number = $found_node->Data;
break;
case 'BUYER-SHIPPING-ADDRESS':
$user_address['Shipping'] = $node_data;
break;
case 'BUYER-BILLING-ADDRESS':
$user_address['Billing'] = $node_data;
break;
}
}
// 2. update shipping address in order
$order = $this->Application->recallObject('ord', null, Array ('skip_autoload' => true));
/* @var $order OrdersItem */
$order->Load($order_id);
if (!$order->isLoaded()) {
return false;
}
// 2.1. this is 100% notification from google -> mark order with such payment type
$order->SetDBField('PaymentType', $this->Application->GetVar('payment_type_id'));
$this->parsed_responce = Array (
'GOOGLE-ORDER-NUMBER' => $google_order_number,
'BUYER-ID' => $buyer_id
);
// 2.2. save google checkout order information (maybe needed for future notification processing)
$order->SetDBField('GWResult1', serialize($this->parsed_responce));
$order->SetDBField('GoogleOrderNumber', $google_order_number);
// 2.3. set user-selected shipping type
$shipping_types = $this->getOrderShippings($order);
foreach ($shipping_types as $shipping_type) {
if ($shipping_type['ShippingName'] == $shpipping_info['SHIPPING-NAME']) {
$order->SetDBField('ShippingInfo', serialize(Array (1 => $shipping_type))); // minimal package number is 1
$order->SetDBField('ShippingCost', $shipping_type['TotalCost']); // set total shipping cost
break;
}
}
// 2.4. set full shipping & billing address
$address_mapping = Array (
'CONTACT-NAME' => 'To',
'COMPANY-NAME' => 'Company',
'EMAIL' => 'Email',
'PHONE' => 'Phone',
'FAX' => 'Fax',
'ADDRESS1' => 'Address1',
'ADDRESS2' => 'Address2',
'CITY' => 'City',
'REGION' => 'State',
'POSTAL-CODE' => 'Zip',
);
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
foreach ($user_address as $field_prefix => $address_details) {
foreach ($address_mapping as $src_field => $dst_field) {
$order->SetDBField($field_prefix.$dst_field, $address_details[$src_field]);
}
if (!$order->GetDBField($field_prefix.'Phone')) {
$order->SetDBField($field_prefix.'Phone', '-'); // required field
}
$order->SetDBField( $field_prefix.'Country', $cs_helper->getCountryIso($address_details['COUNTRY-CODE'], true) );
}
$order->SetDBField('OnHold', 1);
$order->SetDBField('Status', ORDER_STATUS_PENDING);
$order->Update();
// unlink order, that GoogleCheckout used from shopping cart on site
$sql = 'DELETE
FROM '.TABLE_PREFIX.'UserSessionData
WHERE VariableName = "ord_id" AND VariableValue = '.$order->GetID();
$this->Conn->Query($sql);
// simulate visiting shipping screen
$sql = 'UPDATE '.TABLE_PREFIX.'OrderItems
SET PackageNum = 1
WHERE OrderId = '.$order->GetID();
$this->Conn->Query($sql);
return false;
}
/**
* Saves risk information in order record (3rd step)
*
* @param kXMLNode $root_node
*/
function processRiskInformationNotification(&$root_node)
{
// 1. extract data from xml
$search_nodes = Array (
'GOOGLE-ORDER-NUMBER',
'RISK-INFORMATION',
);
foreach ($search_nodes as $search_string) {
$found_node =& $root_node;
/* @var $found_node kXMLNode */
$search_string = explode(':', $search_string);
foreach ($search_string as $search_node) {
$found_node =& $found_node->FindChild($search_node);
}
$node_data = Array ();
if ($found_node->Children) {
$sub_node =& $found_node->firstChild;
/* @var $sub_node kXMLNode */
do {
$node_data[$sub_node->Name] = $sub_node->Data;
} while ( ($sub_node =& $sub_node->NextSibling()) );
}
switch ($found_node->Name) {
case 'GOOGLE-ORDER-NUMBER':
$google_order_number = $found_node->Data;
break;
case 'RISK-INFORMATION':
$risk_information = $node_data;
unset( $risk_information['BILLING-ADDRESS'] );
break;
}
}
// 2. update shipping address in order
$order = $this->Application->recallObject('ord', null, Array ('skip_autoload' => true));
/* @var $order OrdersItem */
$order->Load($google_order_number, 'GoogleOrderNumber');
if (!$order->isLoaded()) {
return false;
}
// 2.1. save risk information in order
$this->parsed_responce = unserialize($order->GetDBField('GWResult1'));
$this->parsed_responce = array_merge_recursive($this->parsed_responce, $risk_information);
$order->SetDBField('GWResult1', serialize($this->parsed_responce));
$order->Update();
return false;
}
/**
* Perform PREAUTH/SALE type transaction direct from php script wihtout redirecting to 3rd-party website
*
* @param Array $item_data
* @param Array $gw_params
* @return bool
*/
function DirectPayment($item_data, $gw_params)
{
$this->gwParams = $gw_params;
if ($gw_params['shipping_control'] == SHIPPING_CONTROL_PREAUTH) {
// when shipping control is Pre-Authorize -> do nothing and charge when admin approves order
return true;
}
$this->_chargeOrder($item_data);
return false;
}
/**
* Issue charge-order api call
*
* @param Array $item_data
* @return bool
*/
function _chargeOrder($item_data)
{
$charge_xml = ' <charge-order xmlns="http://checkout.google.com/schema/2" google-order-number="'.$item_data['GoogleOrderNumber'].'">
<amount currency="USD">'.sprintf('%.2f', $item_data['TotalAmount']).'</amount>
</charge-order>';
$root_node =& $this->executeAPICommand($charge_xml);
$this->parsed_responce = unserialize($item_data['GWResult1']);
if ($root_node->Name == 'REQUEST-RECEIVED') {
$this->parsed_responce['FINANCIAL-ORDER-STATE'] = 'CHARGING';
return true;
}
return false;
}
/**
* Perform SALE type transaction direct from php script wihtout redirecting to 3rd-party website
*
* @param Array $item_data
* @param Array $gw_params
* @return bool
*/
function Charge($item_data, $gw_params)
{
$this->gwParams = $gw_params;
if ($gw_params['shipping_control'] == SHIPPING_CONTROL_DIRECT) {
// when shipping control is Direct Payment -> do nothing and auto-charge on notification received
return true;
}
$this->_chargeOrder($item_data);
$order = $this->Application->recallObject('ord.-item', null, Array ('skip_autoload' => true));
/* @var $order OrdersItem */
$order->Load($item_data['OrderId']);
if (!$order->isLoaded()) {
return false;
}
$order->SetDBField('OnHold', 1);
$order->Update();
return false;
}
/**
* Executes API command for order and returns result
*
* @param string $command_xml
* @return kXMLNode
*/
function &executeAPICommand($command_xml)
{
$submit_url = $this->gwParams['submit_url'].'/request/Merchant/'.$this->gwParams['merchant_id'];
$curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$xml_helper = $this->Application->recallObject('kXMLHelper');
/* @var $xml_helper kXMLHelper */
$curl_helper->SetPostData($command_xml);
$auth_options = Array (
CURLOPT_USERPWD => $this->gwParams['merchant_id'].':'.$this->gwParams['merchant_key'],
);
$curl_helper->setOptions($auth_options);
$xml_responce = $curl_helper->Send($submit_url);
$root_node =& $xml_helper->Parse($xml_responce);
/* @var $root_node kXMLNode */
return $root_node;
}
/**
* Marks order as pending, when it's google status becomes CHARGEABLE (4th step)
*
* @param kXMLNode $root_node
*/
function processOrderStateChangeNotification(&$root_node)
{
// 1. extract data from xml
$search_nodes = Array (
'GOOGLE-ORDER-NUMBER',
'NEW-FINANCIAL-ORDER-STATE',
'PREVIOUS-FINANCIAL-ORDER-STATE',
);
$order_state = Array ();
foreach ($search_nodes as $search_string) {
$found_node =& $root_node;
/* @var $found_node kXMLNode */
$search_string = explode(':', $search_string);
foreach ($search_string as $search_node) {
$found_node =& $found_node->FindChild($search_node);
}
switch ($found_node->Name) {
case 'GOOGLE-ORDER-NUMBER':
$google_order_number = $found_node->Data;
break;
case 'NEW-FINANCIAL-ORDER-STATE':
$order_state['new'] = $found_node->Data;
break;
case 'PREVIOUS-FINANCIAL-ORDER-STATE':
$order_state['old'] = $found_node->Data;
break;
}
}
// 2. update shipping address in order
$order = $this->Application->recallObject('ord', null, Array ('skip_autoload' => true));
/* @var $order OrdersItem */
$order->Load($google_order_number, 'GoogleOrderNumber');
if (!$order->isLoaded()) {
return false;
}
$state_changed = ($order_state['old'] != $order_state['new']);
if ($state_changed) {
$order_charged = ($order_state['new'] == 'CHARGED') && ($order->GetDBField('Status') == ORDER_STATUS_PENDING);
$this->parsed_responce = unserialize($order->GetDBField('GWResult1'));
$this->parsed_responce['FINANCIAL-ORDER-STATE'] = $order_state['new'];
$order->SetDBField('GWResult1', serialize($this->parsed_responce));
if ($order_charged) {
// when using Pre-Authorize
$order->SetDBField('OnHold', 0);
}
$order->Update();
if ($order_charged) {
// when using Pre-Authorize
$order_eh = $this->Application->recallObject('ord_EventHandler');
/* @var $order_eh OrdersEventHandler */
$order_eh->SplitOrder( new kEvent('ord:OnMassOrderApprove'), $order);
}
}
// update order record in "google_checkout_notify.php" only when such state change happens
$order_chargeable = ($order_state['new'] == 'CHARGEABLE') && $state_changed;
if ($order_chargeable) {
if ($this->gwParams['shipping_control'] == SHIPPING_CONTROL_PREAUTH) {
$order->SetDBField('OnHold', 0);
$order->Update();
}
$process_xml = '<process-order xmlns="http://checkout.google.com/schema/2" google-order-number="'.$order->GetDBField('GoogleOrderNumber').'"/>';
$root_node =& $this->executeAPICommand($process_xml);
}
return $order_chargeable;
}
/**
* Retrieves shipping types available for given order
*
* @param OrdersItem $order
* @return Array
*/
function getOrderShippings(&$order)
{
$weight_sql = 'IF(oi.Weight IS NULL, 0, oi.Weight * oi.Quantity)';
$query = ' SELECT
SUM(oi.Quantity) AS TotalItems,
SUM('.$weight_sql.') AS TotalWeight,
SUM(oi.Price * oi.Quantity) AS TotalAmount,
SUM(oi.Quantity) - SUM(IF(p.MinQtyFreePromoShipping > 0 AND p.MinQtyFreePromoShipping <= oi.Quantity, oi.Quantity, 0)) AS TotalItemsPromo,
SUM('.$weight_sql.') - SUM(IF(p.MinQtyFreePromoShipping > 0 AND p.MinQtyFreePromoShipping <= oi.Quantity, '.$weight_sql.', 0)) AS TotalWeightPromo,
SUM(oi.Price * oi.Quantity) - SUM(IF(p.MinQtyFreePromoShipping > 0 AND p.MinQtyFreePromoShipping <= oi.Quantity, oi.Price * oi.Quantity, 0)) AS TotalAmountPromo
FROM '.TABLE_PREFIX.'OrderItems oi
LEFT JOIN '.TABLE_PREFIX.'Products p ON oi.ProductId = p.ProductId
WHERE oi.OrderId = '.$order->GetID().' AND p.Type = 1';
$shipping_totals = $this->Conn->GetRow($query);
$this->Application->recallObject('ShippingQuoteEngine');
$quote_engine_collector = $this->Application->recallObject('ShippingQuoteCollector');
/* @var $quote_engine_collector ShippingQuoteCollector */
$shipping_quote_params = Array(
'dest_country' => $order->GetDBField('ShippingCountry'),
'dest_state' => $order->GetDBField('ShippingState'),
'dest_postal' => $order->GetDBField('ShippingZip'),
'dest_city' => $order->GetDBField('ShippingCity'),
'dest_addr1' => '',
'dest_addr2' => '',
'dest_name' => 'user-' . $order->GetDBField('PortalUserId'),
'packages' => Array(
Array(
'package_key' => 'package1',
'weight' => $shipping_totals['TotalWeight'],
'weight_unit' => 'KG',
'length' => '',
'width' => '',
'height' => '',
'dim_unit' => 'IN',
'packaging' => 'BOX',
'contents' => 'OTR',
'insurance' => '0'
),
),
'amount' => $shipping_totals['TotalAmount'],
'items' => $shipping_totals['TotalItems'],
'limit_types' => serialize(Array ('ANY')),
'promo_params' => Array (
'items' => $shipping_totals['TotalItemsPromo'],
'amount' => $shipping_totals['TotalAmountPromo'],
'weight' => $shipping_totals['TotalWeightPromo'],
),
);
return $quote_engine_collector->GetShippingQuotes($shipping_quote_params);
}
/**
* Returns gateway responce from last operation
*
* @return string
*/
function getGWResponce()
{
return serialize($this->parsed_responce);
}
/**
* Informs payment gateway, that order has been shipped
*
* http://code.google.com/apis/checkout/developer/Google_Checkout_XML_API_Order_Level_Shipping.html#Deliver_Order
*
* @param Array $item_data
* @param Array $gw_params
* @return bool
*/
function OrderShipped($item_data, $gw_params)
{
$this->gwParams = $gw_params;
$shipping_info = unserialize($item_data['ShippingInfo']);
if (getArrayValue($shipping_info, 'Code')) {
$traking_carrier = '<carrier>'.$item_data['Code'].'</carrier>';
}
if ($item_data['ShippingTracking']) {
$tracking_data = '<tracking-data>'.$traking_carrier.'
<tracking-number>'.$item_data['ShippingTracking'].'</tracking-number>
</tracking-data>';
}
$ship_xml = ' <deliver-order xmlns="http://checkout.google.com/schema/2" google-order-number="'.$item_data['GoogleOrderNumber'].'">
'.$traking_data.'
<send-email>true</send-email>
</deliver-order>';
$root_node =& $this->executeAPICommand($ship_xml);
}
/**
* Informs payment gateway, that order has been declined
*
* @param Array $item_data
* @param Array $gw_params
* @return bool
*/
function OrderDeclined($item_data, $gw_params)
{
}
}
\ No newline at end of file
Index: branches/5.3.x/units/gateways/gw_classes/sella_guestpay.php
===================================================================
--- branches/5.3.x/units/gateways/gw_classes/sella_guestpay.php (revision 15898)
+++ branches/5.3.x/units/gateways/gw_classes/sella_guestpay.php (revision 15899)
@@ -1,163 +1,163 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
require_once GW_CLASS_PATH.'/gw_base.php';
$class_name = 'kSellaGuestPayGW'; // for automatic installation
class kSellaGuestPayGW extends kGWBase
{
function InstallData()
{
$data = array(
'Gateway' => Array('Name' => 'Sella/GuestPay', 'ClassName' => 'kSellaGuestPayGW', 'ClassFile' => 'sella_guestpay.php', 'RequireCCFields' => 0),
'ConfigFields' => Array(
'merchant_id' => Array('Name' => 'Merchant ID', 'Type' => 'text', 'ValueList' => '', 'Default' => ''),
'merchant_country' => Array('Name' => 'Merchant Country Code', 'Type' => 'text', 'ValueList' => '', 'Default' => ''),
'currency_code' => Array('Name' => 'Currency Code', 'Type' => 'text', 'ValueList' => '', 'Default' => '978'),
'language_code' => Array('Name' => 'Language Code', 'Type' => 'text', 'ValueList' => '', 'Default' => '2'),
'shipping_control' => Array('Name' => 'Shipping Control', 'Type' => 'select', 'ValueList' => '3=la_CreditDirect,4=la_CreditPreAuthorize', 'Default' => '3'),
)
);
return $data;
}
/**
* Returns payment form submit url
*
* @param Array $gw_params gateway params from payment type config
* @return string
*/
function getFormAction($gw_params)
{
return 'https://ecomm.sella.it/gestpay/pagam.asp';
}
/**
* Processed input data and convets it to fields understandable by gateway
*
* @param Array $item_data
* @param Array $tag_params additional params for gateway passed through tag
* @param Array $gw_params gateway params from payment type config
* @return Array
*/
function getHiddenFields($item_data, $tag_params, $gw_params)
{
$a = $gw_params['merchant_id'];
$params['PAY1_UICCODE'] = $gw_params['currency_code'];
$params['PAY1_AMOUNT'] = $item_data['TotalAmount'];
$params['PAY1_SHOPTRANSACTIONID'] = $item_data['OrderId'];
$params['PAY1_IDLANGUAGE'] = $gw_params['language_code'];
$params['CUSTOM_INFO'] = $this->Application->GetSID().','.MD5($item_data['OrderId']);
$separator = '*P1*';
$b = array();
foreach ($params as $key=>$val) {
- $b[] = $key.'='.urlencode(trim($val));
+ $b[] = $key.'='.kUtil::escape(trim($val), kUtil::ESCAPE_URL);
}
//the last one is CUSTOMINFO according to GW specs, passing the atosorigin-style 'caddie'
$b = join($separator, $b);
$url = 'https://ecomm.sella.it/CryptHTTPS/Encrypt.asp?a='.$a.'&b='.$b.'&c=2.0';
$curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$res = $curl_helper->Send($url);
preg_match('/#cryptstring#(.*)#\/cryptstring#/', $res, $matches);
$b = $matches[1];
$res = '<input type="hidden" name="a" value="'.$a.'"><input type="hidden" name="b" value="'.$b.'">';
return $res;
}
function NeedPlaceButton($item_data, $tag_params, $gw_params)
{
return true;
}
function processNotification($gw_params)
{
$a = $gw_params['merchant_id'];
$b = $_GET['b'];
$url = 'https://ecomm.sella.it/CryptHTTPS/Decrypt.asp?a='.$a.'&b='.$b.'&c=2.0';
$curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$ret = $curl_helper->Send($url);
$result = $this->parseGWResponce($ret, $gw_params);
list ($sid, $auth_code) = explode(',', $result['CUSTOM_INFO']);
$session = $this->Application->recallObject('Session');
$session->SID = $sid;
$order_id = $this->Conn->GetOne('SELECT OrderId FROM '.TABLE_PREFIX.'Orders WHERE md5(OrderId) = '.$this->Conn->qstr($auth_code));
$this->Application->SetVar('ord_id', $order_id);
$order = $this->Application->recallObject('ord');
$order->Load($order_id);
if ($this->Application->GetVar('sella_ok')) {
if ($result['PAY1_TRANSACTIONRESULT'] == 'OK') {
$this->Application->Redirect('in-commerce/checkout/checkout_success', null, '_FRONT_END_', 'index.php');
}
else {
$this->Application->SetVar('sella_error', 1);
}
}
if ($this->Application->GetVar('sella_error')) {
$this->Application->StoreVar('gw_error', $this->getErrorMsg());
$this->Application->Redirect('in-commerce/checkout/billing', null, '_FRONT_END_', 'index.php');
}
return $result['PAY1_TRANSACTIONRESULT'] == 'OK' ? 1 : 0;
}
function parseGWResponce($str, $gw_params)
{
if (preg_match('/#decryptstring#(.*)#\/decryptstring#/', $str, $matches)) {
$separator = '*P1*';
$pairs = explode($separator, $matches[1]);
foreach ($pairs as $a_pair) {
list($key, $val) = explode('=', $a_pair);
$result[$key] = $val;
}
}
elseif (preg_match('/#error#(.*)#\/error#/', $str, $matches))
{
$result['PAY1_ERRORDESCRIPTION'] = $matches[1];
}
else { //unknown error
$result['PAY1_ERRORDESCRIPTION'] = 'Unknown error';
}
$this->parsed_responce = $result;
return $result;
}
function getGWResponce()
{
return serialize($this->parsed_responce);
}
function getErrorMsg()
{
$msg = $this->parsed_responce['PAY1_ERRORDESCRIPTION'];
if (!$msg) {
if ($this->parsed_responce['response_code'] != 'OK') {
$msg = 'Transaction failed';
}
}
return $msg;
}
}
\ No newline at end of file
Index: branches/5.3.x/units/gateways/gw_classes/ideal_nl.php
===================================================================
--- branches/5.3.x/units/gateways/gw_classes/ideal_nl.php (revision 15898)
+++ branches/5.3.x/units/gateways/gw_classes/ideal_nl.php (revision 15899)
@@ -1,170 +1,170 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
/* http://www.ideal.nl/ gateway class */
require_once GW_CLASS_PATH.'/gw_base.php';
$class_name = 'kGWiDEALnl'; // for automatic installation
class kGWiDEALnl extends kGWBase
{
function InstallData()
{
$data = array(
'Gateway' => Array('Name' => 'iDEAL.nl', 'ClassName' => 'kGWiDEALnl', 'ClassFile' => 'ideal_nl.php', 'RequireCCFields' => 0),
'ConfigFields' => Array(
'partner_id' => Array('Name' => 'Partner ID', 'Type' => 'text', 'ValueList' => '', 'Default' => ''),
'request_url' => Array('Name' => 'Request URL', 'Type' => 'text', 'ValueList' => '', 'Default' => 'http://www.mollie.nl/xml/ideals'),
'shipping_control' => Array('Name' => 'Shipping Control', 'Type' => 'select', 'ValueList' => '3=la_CreditDirect,4=la_CreditPreAuthorize', 'Default' => '3'),
)
);
return $data;
}
/**
* Processed input data and convets it to fields understandable by gateway
*
* @param Array $item_data
* @param Array $tag_params additional params for gateway passed through tag
* @param Array $gw_params gateway params from payment type config
* @return Array
*/
function getHiddenFields($item_data, $tag_params, $gw_params)
{
$this->Application->StoreVar('gw_success_template',$tag_params['return_template']);
$this->Application->StoreVar('gw_cancel_template',$tag_params['cancel_template']);
$curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$banks = $curl_helper->Send($gw_params['request_url'].'?a=banklist');
$parser = $this->Application->recallObject('kXMLHelper');
/* @var $parser kXMLHelper */
$bank_data =& $parser->Parse($banks);
$bank_data->FindChild('response');
$banks = array();
foreach ($bank_data->Children as $a_child) {
if ($a_child->Name != 'BANK') continue;
$banks[$a_child->FindChildValue('bank_id')] = $a_child->FindChildValue('bank_name');
}
$ret = $this->Application->Phrase('lu_Select_iDEAL_bank').': <select name="ideal_nl_bank_id">';
foreach ($banks as $id => $name) {
$ret .= '<option value="'.$id.'">'.$name.'</option>';
}
$ret .= '</select>';
$ret .= '<input type="hidden" name="events[ord]" value="OnCompleteOrder" />'."\n";
return $ret;
}
function DirectPayment($item_data, $gw_params)
{
$fields = array();
$fields['a'] = 'fetch';
$fields['partnerid'] = $gw_params['partner_id'];
$txt_amount = sprintf("%.2f", $item_data['TotalAmount']);
$fields['amount'] = str_replace( Array('.', ','), '', $txt_amount);
$fields['bank_id'] = $this->Application->GetVar('ideal_nl_bank_id');
$fields['description'] = 'Invoice #'.$item_data['OrderNumber'];
$fields['returnurl'] = $this->getNotificationUrl() . '?order_id='.$item_data['OrderId'];
$fields['reporturl'] = $this->getNotificationUrl() . '?mode=report&order_id='.$item_data['OrderId'];
$curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$curl_helper->SetRequestData($fields);
$transaction_xml = $curl_helper->Send($gw_params['request_url']);
$parser = $this->Application->recallObject('kXMLHelper');
/* @var $parser kXMLHelper */
$trans_data =& $parser->Parse($transaction_xml);
$transaction_id = $trans_data->FindChildValue('transaction_id');
$url = $trans_data->FindChildValue('url');
if ($transaction_id && $url) {
$this->Application->Redirect('external:'.$url);
}
else {
$error_msg = $trans_data->FindChildValue('message');
$this->parsed_responce['XML'] = $transaction_xml;
$this->Application->SetVar('failure_template', $this->Application->RecallVar('gw_cancel_template'));
- $this->parsed_responce['MESSAGE'] = $error_msg ? $error_msg : 'Unknown gateway error ('.htmlspecialchars($transaction_xml, null, CHARSET).')';
+ $this->parsed_responce['MESSAGE'] = $error_msg ? $error_msg : 'Unknown gateway error ('.kUtil::escape($transaction_xml, kUtil::ESCAPE_HTML).')';
return false;
}
return true;
}
function getErrorMsg()
{
return $this->parsed_responce['MESSAGE'];
}
function getGWResponce()
{
return serialize($this->parsed_responce);
}
function processNotification($gw_params)
{
// silent mode
if ($this->Application->GetVar('mode') == 'report') {
$fields = array();
$fields['a'] = 'check';
$fields['partnerid'] = $gw_params['partner_id'];
$fields['transaction_id'] = $this->Application->GetVar('transaction_id');
$fields['bank_id'] = $this->Application->GetVar('ideal_nl_bank_id');
$curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$curl_helper->SetRequestData($fields);
$check_xml = $curl_helper->Send($gw_params['request_url']);
$parser = $this->Application->recallObject('kXMLHelper');
/* @var $parser kXMLHelper */
$trans_data =& $parser->Parse($check_xml);
$response = $trans_data->FindChild('order');
foreach ($response->Children as $a_child) {
$this->parsed_responce[$a_child->Name] = $a_child->Data;
}
$this->parsed_responce['XML'] = $check_xml;
$result = $trans_data->FindChildValue('payed') == 'true' ? 1:0;
return $result;
}
else {
$order = $this->Application->recallObject('ord');
if ($order->GetDBField('Status') == ORDER_STATUS_INCOMPLETE) {
// error
$t = $this->Application->RecallVar('gw_cancel_template');
$this->parsed_responce = unserialize($order->GetDBField('GWResult1'));
$this->Application->StoreVar('gw_error', $this->getErrorMsg());
$this->Application->Redirect($t, array('pass'=>'m', 'm_cat_id'=>0));
}
else {
// ok
$t = $this->Application->RecallVar('gw_success_template');
$this->Application->Redirect($t, array('pass'=>'m', 'm_cat_id'=>0));
}
}
}
}
\ No newline at end of file
Index: branches/5.3.x/units/gateways/gw_tag_processor.php
===================================================================
--- branches/5.3.x/units/gateways/gw_tag_processor.php (revision 15898)
+++ branches/5.3.x/units/gateways/gw_tag_processor.php (revision 15899)
@@ -1,127 +1,127 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class GatewayTagProcessor extends kDBTagProcessor {
/**
* Payment gateway config values for current payment type
*
* @var Array
* @access private
*/
var $ConfigValues=Array();
/**
* Payment type id for current gateway values
*
* @var int
* @access private
*/
var $PaymentTypeID=0;
function initGWConfigValues()
{
$payment_type_id = $this->Application->GetVar('pt_id');
$GWConfigValue = $this->Application->recallObject('gwfv');
$sql = 'SELECT Value, GWConfigFieldId FROM '.$GWConfigValue->TableName.' WHERE PaymentTypeId = '.$payment_type_id;
$this->ConfigValues = $this->Conn->GetCol($sql,'GWConfigFieldId');
}
function gwConfigValue($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$id = $object->GetID();
$value = isset($this->ConfigValues[$id]) ? $this->ConfigValues[$id] : '';
if ( !array_key_exists('no_special', $params) || !$params['no_special'] ) {
- $value = htmlspecialchars($value, null, CHARSET);
+ $value = kUtil::escape($value);
}
if ( getArrayValue($params, 'checked') ) {
$value = ($value == 1) ? 'checked' : '';
}
return $value;
}
function PrintList($params)
{
$list = $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List', $params);
$id_field = $this->getUnitConfig()->getIDField();
$list->Query();
$list->GoFirst();
$block_params=$this->prepareTagParams($params);
$block_params['name']=$params['block'];
$block_params['pass_params']='true';
$payment_type_object = $this->Application->recallObject('pt');
$o = '';
while (!$list->EOL())
{
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) );
$display_style = $payment_type_object->GetDBField('GatewayId') == $list->GetDBField('GatewayId') ? 'table-row' : 'none';
$block_params['input_block'] = $params['input_block_prefix'].$list->GetDBField('ElementType');
$block_params['gateway_id'] = $list->GetDBField('GatewayId');
$block_params['display'] = $display_style;
$o .= $this->Application->ParseBlock($block_params, 1);
$list->GoNext();
}
return $o;
}
/**
* Prints list a all possible field options
*
* @param Array $params
* @return string
* @access protected
*/
protected function PredefinedOptions($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['pass_params'] = 'true';
$o = '';
$value = $this->gwConfigValue($params);
$options = explode(',', $object->GetDBField('ValueList'));
foreach ($options as $key_val) {
list($key, $val) = explode('=', $key_val);
$block_params['key'] = $key;
$block_params['option'] = $val;
$block_params['selected'] = ($key == $value ? ' ' . $params['selected'] : '');
$block_params['PrefixSpecial'] = $this->getPrefixSpecial();
$o .= $this->Application->ParseBlock($block_params, 1);
}
return $o;
}
}
\ No newline at end of file
Index: branches/5.3.x/units/product_options/product_options_tag_processor.php
===================================================================
--- branches/5.3.x/units/product_options/product_options_tag_processor.php (revision 15898)
+++ branches/5.3.x/units/product_options/product_options_tag_processor.php (revision 15899)
@@ -1,175 +1,175 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class ProductOptionsTagProcessor extends kDBTagProcessor {
function ShowOptions($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$opt_helper = $this->Application->recallObject('kProductOptionsHelper');
/* @var $opt_helper kProductOptionsHelper */
$parsed = $opt_helper->ExplodeOptionValues($object->GetFieldValues());
if ( !$parsed ) {
return '';
}
$values = $parsed['Values'];
$conv_prices = $parsed['Prices'];
$conv_price_types = $parsed['PriceTypes'];
$options =& $this->GetOptions();
$mode = $this->SelectParam($params, 'mode');
$combination_prefix = $this->SelectParam($params, 'combination_prefix');
$combination_field = $this->SelectParam($params, 'combination_field');
if ( $mode == 'selected' ) {
$comb = $this->Application->recallObject($combination_prefix);
/* @var $comb kDBItem */
$options = unserialize($comb->GetDBField($combination_field));
}
$block_params['name'] = $params['render_as'];
$block_params['selected'] = '';
$block_params['pass_params'] = 1;
$lang = $this->Application->recallObject('lang.current');
/* @var $lang LanguagesItem */
$o = '';
$first_selected = false;
foreach ($values as $option) {
// list($val, $label) = explode('|', $option);
$val = $option;
if ( getArrayValue($params, 'js') ) {
- $block_params['id'] = addslashes($val);
- $block_params['value'] = htmlspecialchars($val, null, CHARSET);
+ $block_params['id'] = kUtil::escape($val, kUtil::ESCAPE_JS);
+ $block_params['value'] = kUtil::escape($val);
}
else {
- $block_params['id'] = htmlspecialchars($val, null, CHARSET);
- $block_params['value'] = htmlspecialchars($val, null, CHARSET);
+ $block_params['id'] = kUtil::escape($val);
+ $block_params['value'] = kUtil::escape($val);
}
if ( $conv_prices[$val] ) {
if ( $conv_price_types[$val] == '$' && !getArrayValue($params, 'js') && !getArrayValue($params, 'no_currency') ) {
$iso = $this->GetISO($params['currency']);
$value = sprintf("%.2f", $this->ConvertCurrency($conv_prices[$val], $iso));
$value = $this->AddCurrencySymbol($lang->formatNumber($value, 2), $iso, true); // true to force sign
$block_params['price'] = $value;
$block_params['price_type'] = '';
$block_params['sign'] = ''; //sign is included in the formatted value
}
else {
$block_params['price'] = isset($params['js']) ? $conv_prices[$val] : $lang->formatNumber($conv_prices[$val], 2);
$block_params['price_type'] = $conv_price_types[$val];
$block_params['sign'] = $conv_prices[$val] >= 0 ? '+' : '-';
}
}
else {
$block_params['price'] = '';
$block_params['price_type'] = '';
$block_params['sign'] = '';
}
/*if ($mode == 'selected') {
$selected = $combination[$object->GetID()] == $val;
}
else*/
$selected = false;
if ( !$options && isset($params['preselect_first']) && $params['preselect_first'] && !$first_selected ) {
$selected = true;
$first_selected = true;
}
if ( is_array($options) ) {
$option_value = array_key_exists($object->GetID(), $options) ? $options[$object->GetID()] : '';
if ( $object->GetDBField('OptionType') == OptionType::CHECKBOX ) {
- $selected = is_array($option_value) && in_array(htmlspecialchars($val, null, CHARSET), $option_value);
+ $selected = is_array($option_value) && in_array(kUtil::escape($val), $option_value);
}
else { // radio buttons ?
$selected = htmlspecialchars_decode($option_value) == $val;
}
}
if ( $selected ) {
if ( $mode == 'selected' ) {
if ( $object->GetDBField('OptionType') != OptionType::CHECKBOX ) {
$block_params['selected'] = ' selected="selected" ';
}
else {
$block_params['selected'] = ' checked="checked" ';
}
}
else {
switch ($object->GetDBField('OptionType')) {
case OptionType::DROPDOWN:
$block_params['selected'] = ' selected="selected" ';
break;
case OptionType::RADIO:
case OptionType::CHECKBOX:
$block_params['selected'] = ' checked="checked" ';
break;
}
}
}
else {
$block_params['selected'] = '';
}
$o .= $this->Application->ParseBlock($block_params);
}
return $o;
}
function &GetOptions()
{
$opt_data = $this->Application->GetVar('options');
$options = getArrayValue($opt_data, $this->Application->GetVar('p_id'));
if (!$options && $this->Application->GetVar('orditems_id')) {
$ord_item = $this->Application->recallObject('orditems.-opt', null, Array ('skip_autoload' => true));
/* @var $ord_item kDBItem */
$ord_item->Load($this->Application->GetVar('orditems_id'));
$item_data = unserialize($ord_item->GetDBField('ItemData'));
$options = getArrayValue($item_data, 'Options');
}
return $options;
}
function OptionData($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$options =& $this->GetOptions();
return getArrayValue($options, $object->GetID());
}
function ListOptions($params)
{
return $this->PrintList2($params);
}
}
\ No newline at end of file
Index: branches/5.3.x/units/pricing/pricing_event_handler.php
===================================================================
--- branches/5.3.x/units/pricing/pricing_event_handler.php (revision 15898)
+++ branches/5.3.x/units/pricing/pricing_event_handler.php (revision 15899)
@@ -1,522 +1,525 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
// include globals.php from current folder
kUtil::includeOnce(MODULES_PATH . '/in-commerce/units/pricing/globals.php');
class PricingEventHandler extends kDBEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnMoreBrackets' => Array ('subitem' => 'add|edit'),
'OnInfinity' => Array ('subitem' => 'add|edit'),
'OnArrange' => Array ('subitem' => 'add|edit'),
'OnDeleteBrackets' => Array ('subitem' => 'add|edit'),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Define alternative event processing method names
*
* @return void
* @see kEventHandler::$eventMethods
* @access protected
*/
protected function mapEvents()
{
parent::mapEvents(); // ensure auto-adding of approve/decline and so on events
$brackets_events = Array(
'OnMoreBrackets' => 'PricingBracketsAction',
'OnArrange' => 'PricingBracketsAction',
'OnInfinity' => 'PricingBracketsAction',
'OnDeleteBrackets' => 'PricingBracketsAction',
);
$this->eventMethods = array_merge($this->eventMethods, $brackets_events);
}
function PricingBracketsAction($event)
{
$event->redirect=false;
$temp = $this->Application->GetVar($event->getPrefixSpecial(true));
// $object = $event->getObject();
// $formatter = $this->Application->recallObject('kFormatter');
// $temp = $formatter->TypeCastArray($temp, $object);
//uasort($temp, 'pr_bracket_comp');
$bracket = $this->Application->recallObject($event->getPrefixSpecial());
foreach($temp as $id => $record)
{
if( $record['MaxQty'] == '&#8734;' || $record['MaxQty'] == '∞')
{
$temp[$id]['MaxQty'] = -1;
}
}
$group_id = $this->Application->getVar('group_id');
if($group_id>0){
$where_group=' GroupId = '.$group_id.' ';
}
else {
$where_group= ' TRUE ';
}
switch ($event->Name)
{
case 'OnMoreBrackets':
$new_id = (int)$this->Conn->GetOne('SELECT MIN('.$bracket->IDField.') FROM '.$bracket->TableName);
if($new_id > 0) $new_id = 0;
do
{
$new_id--;
} while
($this->check_array($this->Application->GetVar($event->getPrefixSpecial(true)), 'PriceId', $new_id));
$last_max_qty = $this->Conn->GetOne('SELECT MAX(MaxQty) FROM '.$bracket->TableName.' WHERE '.$where_group);
$min_qty = $this->Conn->GetOne('SELECT MIN(MaxQty) FROM '.$bracket->TableName.' WHERE '.$where_group);
if ($min_qty==-1) $last_max_qty = -1;
if (!$last_max_qty) $last_max_qty=1;
for($i = $new_id; $i > $new_id - 5; $i--)
{
$temp[$i]['PriceId'] = $i;
$temp[$i]['MinQty'] = ($i == $new_id-4 && $last_max_qty != -1) ? $last_max_qty : '';
$temp[$i]['MaxQty'] = ($i == $new_id-4 && $last_max_qty != -1) ? -1 : '';
$temp[$i]['Price'] = '';
$temp[$i]['Cost'] = '';
$temp[$i]['Points'] = '';
$temp[$i]['Negotiated'] = '0';
$temp[$i]['IsPrimary'] = '0';
$temp[$i]['GroupId'] = $group_id;
}
$this->Application->SetVar($event->getPrefixSpecial(true), $temp);
$event->CallSubEvent('OnPreSaveBrackets');
break;
case 'OnArrange':
$temp=$this->OnArrangeBrackets($event, $temp, $bracket);
$this->Application->SetVar($event->getPrefixSpecial(true), $temp);
$event->CallSubEvent('OnPreSaveBrackets');
break;
case 'OnInfinity':
$temp=$this->OnArrangeBrackets($event, $temp, $bracket);
$this->Application->SetVar($event->getPrefixSpecial(true), $temp);
$event->CallSubEvent('OnPreSaveBrackets');
$infinite_exists = $this->Conn->GetOne('SELECT count(*) FROM '.$bracket->TableName.' WHERE MaxQty=-1 '.' AND '.$where_group);
if($infinite_exists==0){
reset($temp);
$last_bracket=end($temp);
$new_id = (int)$this->Conn->GetOne('SELECT MIN('.$bracket->IDField.') FROM '.$bracket->TableName);
$brackets_exist = (int)$this->Conn->GetOne('SELECT COUNT(*) FROM '.$bracket->TableName.' WHERE '.$where_group);
if($new_id > 0) $new_id = 0;
do
{
$new_id--;
} while
($this->check_array($this->Application->GetVar($event->getPrefixSpecial(true)), 'PriceId', $new_id));
$infinite_bracket['PriceId'] = $new_id;
$infinite_bracket['MinQty'] = ($brackets_exist>0)?$last_bracket['MaxQty']:1;
$infinite_bracket['MaxQty'] = '-1';
$infinite_bracket['Price'] = '';
$infinite_bracket['Cost'] = '';
$infinite_bracket['Points'] = '';
$infinite_bracket['Negotiated'] = '0';
$infinite_bracket['IsPrimary'] = '0';
$infinite_bracket['GroupId'] = $group_id;
$temp[$new_id]=$infinite_bracket;
reset($temp);
}
$this->Application->SetVar($event->getPrefixSpecial(true), $temp);
$event->CallSubEvent('OnPreSaveBrackets');
break;
case 'OnDeleteBrackets':
if ($group_id) {
$temp = ''; // delete all pricings from "pr_tang" var
$sql = 'DELETE FROM ' . $bracket->TableName . '
WHERE ProductId = ' . $this->Application->GetVar('p_id') . ' AND GroupId = ' . $group_id;
$this->Conn->Query($sql);
}
break;
default:
}
$this->Application->SetVar($event->getPrefixSpecial(true), $temp); // store pr_tang var
}
function OnPreSaveBrackets($event)
{
if( $this->Application->GetVar('pr_tang') ) {
$object = $event->getObject();
/* @var $object kDBItem */
$product_id = $this->Application->GetVar('p_id');
$group_id = $this->Application->getVar('group_id');
$sql = 'SELECT PriceId
FROM ' . $object->TableName . '
WHERE ProductId = ' . $product_id . ' ' . ($group_id? 'AND GroupId = ' . $group_id : '');
$stored_ids = $this->Conn->GetCol($sql);
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); // get pr_tang var
uasort($items_info, 'pr_bracket_comp');
foreach ($items_info as $item_id => $field_values) {
if (in_array($item_id, $stored_ids)) { //if it's already exist
$object->Load($item_id);
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
+ $event->setEventParam('form_data', $field_values);
if (!$object->Validate()) {
unset($stored_ids[array_search($item_id, $stored_ids)]);
$event->redirect = false;
continue;
}
if( $object->Update($item_id) ) {
$event->status=kEvent::erSUCCESS;
}
else {
$event->status=kEvent::erFAIL;
$event->redirect=false;
break;
}
unset($stored_ids[array_search($item_id, $stored_ids)]);
}
else {
$object->Clear();
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
+ $event->setEventParam('form_data', $field_values);
+
$object->SetDBField('ProductId', $product_id);
if( $object->Create() ) {
$event->status=kEvent::erSUCCESS;
}
}
}
// delete
foreach ($stored_ids as $stored_id) {
$this->Conn->Query('DELETE FROM ' . $object->TableName . ' WHERE PriceId = ' . $stored_id);
}
}
}
/**
* Apply custom processing to item
*
* @param kEvent $event
* @param string $type
* @return void
* @access protected
*/
protected function customProcessing(kEvent $event, $type)
{
$bracket = $event->getObject();
/* @var $bracket kDBItem */
switch ($type) {
case 'before':
$bracket->SetDBField('ProductId', $this->Application->GetVar('p_id'));
if ( $bracket->GetDBField('MaxQty') == '&#8734;' || $bracket->GetDBField('MaxQty') == '∞' ) {
$bracket->SetDBField('MaxQty', -1);
}
break;
}
}
function OnArrangeBrackets($event, &$temp, &$bracket)
{
$temp_orig = $temp;
reset($temp);
if (is_array($temp))
{
// array to store max values (2nd column)
$end_values = Array();
// get minimal value of Min
$first_elem=current($temp);
$start = $first_elem['MinQty'];
if (!$start){
$start = 1;
}
foreach($temp as $id => $record)
{
/*
This 3-ifs logic fixes collision with invalid input values having
1 pricing record.
The logic is:
1) If we got Max less than Min, we set Min to 1 that gives us
integrity.
2) If we got equal values for Min and Max, we set range 1..Max like
in previous. But if Min was 1 and Max was 1 we set full range 1..infinity
3) If we got Max = 0 we just set it tom infinity because we can't
guess what user meant
*/
if (sizeof($temp) == 1 && $record['MinQty'] > ($record['MaxQty'] == -1 ? $record['MinQty']+1 : $record['MaxQty']) ){
$record['MinQty'] = 1;
$temp[$id]['MinQty'] = 1;
$start = 1;
}
if (sizeof($temp) == 1 && $record['MinQty'] == $record['MaxQty']){
if ($record['MaxQty'] == 1){
$record['MaxQty'] = -1;
$temp[$id]['MaxQty'] = -1;
}
else {
$record['MinQty'] = 1;
$temp[$id]['MinQty'] = 1;
}
}
if (sizeof($temp) == 1 && $record['MaxQty'] == 0){
$record['MaxQty'] = -1;
$temp[$id]['MaxQty'] = -1;
}
if(
// MAX is less than start
($record['MaxQty'] <= $start && $record['MaxQty'] != -1) ||
// Max is empty
!$record['MaxQty'] ||
// Max already defined in $end_values
(array_search($record['MaxQty'], $end_values) !== false)
) { // then delete from brackets list
unset($temp[$id]);
}
else { // this is when ok - add to end_values list
$end_values[] = $record['MaxQty'];
}
}
// sort brackets by 2nd column (Max values)
uasort($temp, 'pr_bracket_comp');
reset($temp);
$first_item=each($temp);
$first_item_key=$first_item['key'];
$group_id = $this->Application->getVar('group_id');
$default_group = $this->Application->ConfigValue('User_LoggedInGroup');
if($group_id>0){
$where_group=' AND GroupId = '.$group_id.' ';
}
$ids = $this->Conn->GetCol('SELECT PriceId FROM '.$bracket->TableName.' WHERE ProductId='.$this->Application->GetVar('p_id').' '.$where_group);
if(is_array($ids)) {
usort($ids, 'pr_bracket_id_sort');
}
$min_id = min( min($ids) - 1, -1 );
foreach($temp as $key => $record)
{
$temp[$key]['MinQty']=$start;
$temp[$key]['IsPrimary']=0;
$temp[$key]['GroupId']=$group_id;
$start=$temp[$key]['MaxQty'];
}
if ($temp[$first_item_key]['GroupId'] == $default_group) {
$temp[$first_item_key]['IsPrimary']=1;
}
}
return $temp;
}
/**
* Set's price as primary for product
*
* @param kEvent $event
*/
function OnSetPrimary($event)
{
$object = $event->getObject( Array('skip_autoload' => true) );
$this->StoreSelectedIDs($event);
$ids=$this->getSelectedIDs($event);
if($ids)
{
$id = array_shift($ids);
$table_info = $object->getLinkedInfo();
$this->Conn->Query('UPDATE '.$object->TableName.' SET IsPrimary = 0 WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
$this->Conn->Query('UPDATE '.$object->TableName.' SET IsPrimary = 1 WHERE ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].') AND (PriceId = '.$id.')');
}
$event->SetRedirectParam('opener', 's');
}
/**
* Resets primary mark for other prices of given product, when current pricing is primary
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
$object = $event->getObject();
/* @var $object kDBItem */
if ( $object->GetDBField('IsPrimary') == 1 ) {
// make all prices non primary, when this one is
$sql = 'UPDATE ' . $object->TableName . '
SET IsPrimary = 0
WHERE (ProductId = ' . $object->GetDBField('ProductId') . ') AND (' . $object->IDField . ' <> ' . $object->GetID() . ')';
$this->Conn->Query($sql);
}
}
/**
* Occurs before creating item
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
$object = $event->getObject();
/* @var $object kDBItem */
$table_info = $object->getLinkedInfo($event->Special);
$table_info['ParentId'] = ($table_info['ParentId'] ? $table_info['ParentId'] : 0);
if ( $object->GetDBField('IsPrimary') == 1 ) {
$sql = 'UPDATE ' . $object->TableName . '
SET IsPrimary = 0
WHERE ' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId'];
$this->Conn->Query($sql);
}
else {
$sql = 'SELECT COUNT(*)
FROM ' . $object->TableName . '
WHERE ' . $table_info['ForeignKey'] . ' = ' . $table_info['ParentId'];
$prices_qty = $this->Conn->GetOne($sql);
if ( $prices_qty == 0 ) {
$object->SetDBField('IsPrimary', 1);
}
}
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
protected function SetCustomQuery(kEvent $event)
{
$object = $event->getObject();
/* @var $object kDBList */
if ( $this->Application->isAdminUser ) {
return;
}
if ( $this->Application->ConfigValue('Comm_PriceBracketCalculation') == 1 ) {
$sql = 'SELECT PrimaryGroupId
FROM ' . TABLE_PREFIX . 'Users
WHERE PortalUserId = ' . $this->Application->GetVar('u_id');
$pricing_group = $this->Conn->GetOne($sql);
if ( $pricing_group ) {
$sql = 'SELECT COUNT(*)
FROM ' . TABLE_PREFIX . 'ProductsPricing
WHERE ProductId = ' . $this->Application->GetVar('p_id') . ' AND GroupId = ' . $pricing_group . ' AND Price IS NOT NULL';
$pricing_for_group_exists = $this->Conn->GetOne($sql);
}
if ( !$pricing_group || !$pricing_for_group_exists ) {
$pricing_group = $this->Application->ConfigValue('User_LoggedInGroup');
}
}
else {
$user_groups = $this->Application->RecallVar('UserGroups');
//$cheapest_group = $this->Conn->GetOne('SELECT GroupId FROM '.$object->TableName.' WHERE ProductId='.$this->Application->GetVar('p_id').' AND Price IS NOT NULL AND GroupId IN ('.$user_groups.') AND MinQty = 1 GROUP BY GroupId ORDER BY Price ASC');
$sql = 'SELECT PriceId, Price, GroupId
FROM ' . $object->TableName . '
WHERE ProductId = ' . $this->Application->GetVar('p_id') . ' AND Price IS NOT NULL AND GroupId IN (' . $user_groups . ')
ORDER BY GroupId ASC, MinQty ASC';
$effective_brackets = $this->Conn->Query($sql, 'PriceId');
$group_prices = array ();
$min_price = -1;
$cheapest_group = 0;
foreach ($effective_brackets as $bracket) {
if ( !isset($group_prices[$bracket['GroupId']]) ) {
$group_prices[$bracket['GroupId']] = $bracket['Price'];
if ( $bracket['Price'] < $min_price || $min_price == -1 ) {
$min_price = $bracket['Price'];
$cheapest_group = $bracket['GroupId'];
}
}
}
if ( !$cheapest_group ) {
$cheapest_group = $this->Application->ConfigValue('User_LoggedInGroup');
}
$pricing_group = $cheapest_group;
}
$object->addFilter('price_user_group', $object->TableName . '.GroupId=' . $pricing_group);
}
}
\ No newline at end of file
Index: branches/5.3.x/units/destinations/dst_event_handler.php
===================================================================
--- branches/5.3.x/units/destinations/dst_event_handler.php (revision 15898)
+++ branches/5.3.x/units/destinations/dst_event_handler.php (revision 15899)
@@ -1,134 +1,135 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class DstEventHandler extends kDBEventHandler {
/**
* Creates item from submit data
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCreate(kEvent $event)
{
$object = $event->getObject(Array ('skip_autoload' => true));
/* @var $object kDBItem */
// creates multiple db records from single request (OnCreate event only creates 1 record)
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( !$items_info ) {
return;
}
foreach ($items_info as $field_values) {
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
+ $event->setEventParam('form_data', $field_values);
$this->customProcessing($event, 'before');
if ( $object->Create() ) {
$this->customProcessing($event, 'after');
$event->status = kEvent::erSUCCESS;
}
else {
$event->status = kEvent::erFAIL;
$event->redirect = false;
$this->Application->SetVar($event->getPrefixSpecial() . '_SaveEvent', 'OnCreate');
$object->setID(0);
}
}
}
/**
* Apply custom processing to item
*
* @param kEvent $event
* @param string $type
* @return void
* @access protected
*/
protected function customProcessing(kEvent $event, $type)
{
if ( $type != 'before' ) {
return;
}
$object = $event->getObject();
/* @var $object kDBItem */
$events = $this->Application->GetVar('events');
if ( $events['z'] == 'OnUpdate' ) {
$object->SetDBField('ShippingZoneId', $this->Application->GetVar('z_id'));
}
$zone_object = $this->Application->recallObject('z');
/* @var $zone_object kDBItem */
if ( $zone_object->GetDBField('Type') == 3 ) {
$object->SetDBField('StdDestId', $this->Application->GetVar('ZIPCountry'));
}
}
/**
*
*
* @param kEvent $event
*/
function OnZoneUpdate($event) {
$object = $event->getObject();
/* @var $object kDBItem */
$zone_object = $this->Application->recallObject('z');
/* @var $zone_object kDBItem */
$zone_id = (int)$zone_object->GetID();
$zone_type = $zone_object->GetDBField('Type');
$delete_zones_sql = 'DELETE FROM '.$object->TableName.' WHERE ShippingZoneId = '.$zone_id;
$this->Conn->Query($delete_zones_sql);
if ($zone_id != 0){
$delete_zones_sql = 'DELETE FROM '.$object->TableName.' WHERE ShippingZoneId = 0';
$this->Conn->Query($delete_zones_sql);
}
$selected_destinations = $this->Application->GetVar('selected_destinations');
$selected_destinations_array = explode(',', $selected_destinations);
$selected_destinations_array = array_unique($selected_destinations_array);
foreach ($selected_destinations_array as $key => $dest_id) {
if ($zone_object->GetDBField('Type') == 3){
list ($zone_dest_id, $dest_value) = explode('|', $dest_id);
$dest_id = $this->Application->GetVar('CountrySelector');
}
else {
$dest_value = '';
}
if ($dest_id > 0){
$object->SetDBField('ShippingZoneId', $zone_id);
$object->SetDBField('StdDestId', $dest_id);
$object->SetDBField('DestValue', $dest_value);
$object->Create();
}
}
}
}
\ No newline at end of file
Index: branches/5.3.x/units/shipping_quote_engines/usps.php
===================================================================
--- branches/5.3.x/units/shipping_quote_engines/usps.php (revision 15898)
+++ branches/5.3.x/units/shipping_quote_engines/usps.php (revision 15899)
@@ -1,1341 +1,1341 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
define('MODULE_SHIPPING_USPS_TEXT_TITLE', 'United States Postal Service');
define('MODULE_SHIPPING_USPS_TEXT_DESCRIPTION', 'You will need to have registered an account with USPS. Click <a target="_blank" href="https://secure.shippingapis.com/registration/"><strong>HERE</strong></a> for registration details. USPS expects you to use pounds as weight measure for your products.');
define('MODULE_SHIPPING_USPS_TEXT_ERROR', 'An error occured with the USPS shipping calculations.<br>If you prefer to use USPS as your shipping method, please contact the store owner.');
define('MODULE_SHIPPING_USPS_TEXT_DAY', 'Day');
define('MODULE_SHIPPING_USPS_TEXT_DAYS', 'Days');
define('MODULE_SHIPPING_USPS_TEXT_WEEKS', 'Weeks');
define('MODULE_SHIPPING_USPS_STATUS', 'True'); // Do you want to offer USPS shipping?
define('MODULE_SHIPPING_USPS_SERVER', 'production'); // An account at USPS is needed to use the Production server // production othervise value may be 'test'
define('MODULE_SHIPPING_USPS_HANDLING', '0'); // Handling fee for this shipping method
define('MODULE_SHIPPING_USPS_TAX_CLASS', '0'); // Use the following tax class on the shipping fee
define('MODULE_SHIPPING_USPS_ZONE', '0'); // If a zone is selected, only enable this shipping method for that zone.
define('MODULE_SHIPPING_USPS_SORT_ORDER', '0'); // Sort order of display.
define('MODULE_SHIPPING_USPS_TYPES', 'PRIORITY, PARCEL'); // EXPRESS, FIRST CLASS, BMP, MEDIA 'Select the domestic services to be offered:
define('MODULE_SHIPPING_USPS_TYPES_INTL', 'EXPRESS MAIL INTERNATIONAL (EMS), EXPRESS MAIL INT, EXPRESS MAIL INT FLAT RATE ENV, PRIORITY MAIL INT, PRIORITY MAIL INT FLAT RATE ENV, PRIORITY MAILINT FLAT RATE BOX, FIRST-CLASS MAIL INT');// 'GLOBAL EXPRESS, GLOBAL EXPRESS NON-DOC RECT, GLOBAL EXPRESS NON-DOC NON-RECT, Select the international services to be offered:
define('MODULE_SHIPPING_USPS_OPTIONS', 'Display weight, Display transit time'); //
//configuration values for insurance
define('MODULE_SHIPPING_USPS_INS1', '1.65');// 'US/Canada insurance for totals $.01-$50.00
define('MODULE_SHIPPING_USPS_INS2', '2.05');// 'US/Canada insurance for totals $50.01-$100
define('MODULE_SHIPPING_USPS_INS3', '2.45');// 'US/Canada insurance for totals $100.01-$200
define('MODULE_SHIPPING_USPS_INS4', '4.60');// 'US/Canada insurance for totals $200.01-$300
define('MODULE_SHIPPING_USPS_INS5', '.90');// 'US/Canada insurance for every $100 over $300 (add)
define('MODULE_SHIPPING_USPS_INS6', '2.40');// 'International insurance for totals $.01-$50.00
define('MODULE_SHIPPING_USPS_INS7', '3.30');// 'International insurance for totals $50.01-$100
define('MODULE_SHIPPING_USPS_INS8', '4.20');// 'International insurance for totals $100.01-$200
define('MODULE_SHIPPING_USPS_INS9', '5.10');// 'International insurance for totals $200.01-$300
define('MODULE_SHIPPING_USPS_INS10', '.90');// 'International insurance for every $100 over $300 (add)
define('MODULE_SHIPPING_USPS_INSURE', 'True');// 'Insure packages shipped by USPS?
define('MODULE_SHIPPING_USPS_INSURE_TAX', 'True');// 'Insure tax on packages shipped by USPS?
class USPS extends ShippingQuoteEngine
{
var $countries, $pounds, $ounces, $insurance_cost = 0, $shipping_origin_country, $store_first_name, $store_last_name, $company_name, $store_name, $store_address1, $store_address2, $store_city, $store_state, $store_zip5, $store_zip4, $store_phone, $usps_userid;
var $order = Array();
var $types = Array();
var $intl_types = Array();
/**
* Path to a request log file
*
* @var string
*/
var $logFilePath = '';
/**
* Creates USPS processing class
*
*/
public function __construct()
{
parent::__construct();
$this->logFilePath = (defined('RESTRICTED') ? RESTRICTED : WRITEABLE . '/user_files') . '/usps.log';
// EXPRESS, FIRST CLASS, PRIORITY, PARCEL, BMP, MEDIA
$this->types = Array(
'EXPRESS' => 'Express Mail',
'FIRST CLASS' => 'First Class Mail',
'PRIORITY' => 'Priority Mail',
'PARCEL' => 'Parcel Post',
'BPM' => 'Bound Printed Matter',
'MEDIA' => 'Media Mail'
);
$this->intl_types = Array(
// 'GLOBAL EXPRESS' => 'Global Express Guaranteed',
// 'GLOBAL EXPRESS NON-DOC RECT' => 'Global Express Guaranteed Non-Document Rectangular',
// 'GLOBAL EXPRESS NON-DOC NON-RECT' => 'Global Express Guaranteed Non-Document Non-Rectangular',
'EXPRESS MAIL INT' => 'Express Mail International (EMS)',
'EXPRESS MAIL INT FLAT RATE ENV' => 'Express Mail International (EMS) Flat Rate Envelope',
'PRIORITY MAIL INT' => 'Priority Mail International',
'PRIORITY MAIL INT FLAT RATE ENV' => 'Priority Mail International Flat Rate Envelope',
'PRIORITY MAIL INT FLAT RATE BOX' => 'Priority Mail International Flat Rate Box',
'FIRST-CLASS MAIL INT' => 'First-Class Mail International'
);
// get 2-symbol country code
$country = $this->Application->ConfigValue('Comm_Shipping_Country');
if ($country != '') {
$this->shipping_origin_country = $this->GetUSPSCountry($country, '');
}
$contact_name = trim($this->_prepare_xml_param($this->Application->ConfigValue('Comm_Contacts_Name')));
$split_pos = strpos($contact_name, ' ');
if ($split_pos === false) {
$this->store_first_name = $contact_name;
$this->store_last_name = '';
} else {
$this->store_first_name = substr($contact_name, 0, $split_pos);
$this->store_last_name = trim(substr($contact_name, $split_pos));
}
$this->company_name = $this->_prepare_xml_param($this->Application->ConfigValue('Comm_CompanyName'));
$this->store_name = $this->_prepare_xml_param($this->Application->ConfigValue('Comm_StoreName'));
$this->store_address1 = $this->_prepare_xml_param($this->Application->ConfigValue('Comm_Shipping_AddressLine1'));
$this->store_address2 = $this->_prepare_xml_param($this->Application->ConfigValue('Comm_Shipping_AddressLine2'));
if ($this->store_address2 == '') {
$this->store_address2 = $this->store_address1;
$this->store_address1 = '';
}
$this->store_city = $this->_prepare_xml_param($this->Application->ConfigValue('Comm_Shipping_City'));
$this->store_state = $this->_prepare_xml_param($this->Application->ConfigValue('Comm_Shipping_State'));
$zip = $this->_prepare_xml_param($this->Application->ConfigValue('Comm_Shipping_ZIP'));
$this->store_zip5 = substr($zip, 0, 5);
$this->store_zip4 = trim(substr($zip, 6), '-');
$this->store_phone = $this->_prepare_xml_param($this->Application->ConfigValue('Comm_Contacts_Phone'));
// get username and password fron config.
$a_params = $this->LoadParams();
$this->usps_userid = $a_params['AccountLogin'];
// Note by Erik: DO NOT CHANGE THIS ARRAY. It's values are sent to USPS service and any changes may impact class main functionality.
$this->countries = array(
'AF' => 'Afghanistan',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AG' => 'Antigua and Barbuda',
'AR' => 'Argentina',
'AM' => 'Armenia',
'AW' => 'Aruba',
'AU' => 'Australia',
'AT' => 'Austria',
'AZ' => 'Azerbaijan',
'BS' => 'Bahamas',
'BH' => 'Bahrain',
'BD' => 'Bangladesh',
'BB' => 'Barbados',
'BY' => 'Belarus',
'BE' => 'Belgium',
'BZ' => 'Belize',
'BJ' => 'Benin',
'BM' => 'Bermuda',
'BT' => 'Bhutan',
'BO' => 'Bolivia',
'BA' => 'Bosnia-Herzegovina',
'BW' => 'Botswana',
'BR' => 'Brazil',
'VG' => 'British Virgin Islands',
'BN' => 'Brunei Darussalam',
'BG' => 'Bulgaria',
'BF' => 'Burkina Faso',
'MM' => 'Burma',
'BI' => 'Burundi',
'KH' => 'Cambodia',
'CM' => 'Cameroon',
'CA' => 'Canada',
'CV' => 'Cape Verde',
'KY' => 'Cayman Islands',
'CF' => 'Central African Republic',
'TD' => 'Chad',
'CL' => 'Chile',
'CN' => 'China',
'CX' => 'Christmas Island (Australia)',
'CC' => 'Cocos Island (Australia)',
'CO' => 'Colombia',
'KM' => 'Comoros',
'CG' => 'Congo (Brazzaville),Republic of the',
'ZR' => 'Congo, Democratic Republic of the',
'CK' => 'Cook Islands (New Zealand)',
'CR' => 'Costa Rica',
'CI' => 'Cote d\'Ivoire (Ivory Coast)',
'HR' => 'Croatia',
'CU' => 'Cuba',
'CY' => 'Cyprus',
'CZ' => 'Czech Republic',
'DK' => 'Denmark',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'TP' => 'East Timor (Indonesia)',
'EC' => 'Ecuador',
'EG' => 'Egypt',
'SV' => 'El Salvador',
'GQ' => 'Equatorial Guinea',
'ER' => 'Eritrea',
'EE' => 'Estonia',
'ET' => 'Ethiopia',
'FK' => 'Falkland Islands',
'FO' => 'Faroe Islands',
'FJ' => 'Fiji',
'FI' => 'Finland',
'FR' => 'France',
'GF' => 'French Guiana',
'PF' => 'French Polynesia',
'GA' => 'Gabon',
'GM' => 'Gambia',
'GE' => 'Georgia, Republic of',
'DE' => 'Germany',
'GH' => 'Ghana',
'GI' => 'Gibraltar',
'GB' => 'Great Britain and Northern Ireland',
'GR' => 'Greece',
'GL' => 'Greenland',
'GD' => 'Grenada',
'GP' => 'Guadeloupe',
'GT' => 'Guatemala',
'GN' => 'Guinea',
'GW' => 'Guinea-Bissau',
'GY' => 'Guyana',
'HT' => 'Haiti',
'HN' => 'Honduras',
'HK' => 'Hong Kong',
'HU' => 'Hungary',
'IS' => 'Iceland',
'IN' => 'India',
'ID' => 'Indonesia',
'IR' => 'Iran',
'IQ' => 'Iraq',
'IE' => 'Ireland',
'IL' => 'Israel',
'IT' => 'Italy',
'JM' => 'Jamaica',
'JP' => 'Japan',
'JO' => 'Jordan',
'KZ' => 'Kazakhstan',
'KE' => 'Kenya',
'KI' => 'Kiribati',
'KW' => 'Kuwait',
'KG' => 'Kyrgyzstan',
'LA' => 'Laos',
'LV' => 'Latvia',
'LB' => 'Lebanon',
'LS' => 'Lesotho',
'LR' => 'Liberia',
'LY' => 'Libya',
'LI' => 'Liechtenstein',
'LT' => 'Lithuania',
'LU' => 'Luxembourg',
'MO' => 'Macao',
'MK' => 'Macedonia, Republic of',
'MG' => 'Madagascar',
'MW' => 'Malawi',
'MY' => 'Malaysia',
'MV' => 'Maldives',
'ML' => 'Mali',
'MT' => 'Malta',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'MU' => 'Mauritius',
'YT' => 'Mayotte (France)',
'MX' => 'Mexico',
'MD' => 'Moldova',
'MC' => 'Monaco (France)',
'MN' => 'Mongolia',
'MS' => 'Montserrat',
'MA' => 'Morocco',
'MZ' => 'Mozambique',
'NA' => 'Namibia',
'NR' => 'Nauru',
'NP' => 'Nepal',
'NL' => 'Netherlands',
'AN' => 'Netherlands Antilles',
'NC' => 'New Caledonia',
'NZ' => 'New Zealand',
'NI' => 'Nicaragua',
'NE' => 'Niger',
'NG' => 'Nigeria',
'KP' => 'North Korea (Korea, Democratic People\'s Republic of)',
'NO' => 'Norway',
'OM' => 'Oman',
'PK' => 'Pakistan',
'PA' => 'Panama',
'PG' => 'Papua New Guinea',
'PY' => 'Paraguay',
'PE' => 'Peru',
'PH' => 'Philippines',
'PN' => 'Pitcairn Island',
'PL' => 'Poland',
'PT' => 'Portugal',
'QA' => 'Qatar',
'RE' => 'Reunion',
'RO' => 'Romania',
'RU' => 'Russia',
'RW' => 'Rwanda',
'SH' => 'Saint Helena',
'KN' => 'Saint Kitts (St. Christopher and Nevis)',
'LC' => 'Saint Lucia',
'PM' => 'Saint Pierre and Miquelon',
'VC' => 'Saint Vincent and the Grenadines',
'SM' => 'San Marino',
'ST' => 'Sao Tome and Principe',
'SA' => 'Saudi Arabia',
'SN' => 'Senegal',
'YU' => 'Serbia-Montenegro',
'SC' => 'Seychelles',
'SL' => 'Sierra Leone',
'SG' => 'Singapore',
'SK' => 'Slovak Republic',
'SI' => 'Slovenia',
'SB' => 'Solomon Islands',
'SO' => 'Somalia',
'ZA' => 'South Africa',
'GS' => 'South Georgia (Falkland Islands)',
'KR' => 'South Korea (Korea, Republic of)',
'ES' => 'Spain',
'LK' => 'Sri Lanka',
'SD' => 'Sudan',
'SR' => 'Suriname',
'SZ' => 'Swaziland',
'SE' => 'Sweden',
'CH' => 'Switzerland',
'SY' => 'Syrian Arab Republic',
'TW' => 'Taiwan',
'TJ' => 'Tajikistan',
'TZ' => 'Tanzania',
'TH' => 'Thailand',
'TG' => 'Togo',
'TK' => 'Tokelau (Union) Group (Western Samoa)',
'TO' => 'Tonga',
'TT' => 'Trinidad and Tobago',
'TN' => 'Tunisia',
'TR' => 'Turkey',
'TM' => 'Turkmenistan',
'TC' => 'Turks and Caicos Islands',
'TV' => 'Tuvalu',
'UG' => 'Uganda',
'UA' => 'Ukraine',
'AE' => 'United Arab Emirates',
'UY' => 'Uruguay',
'UZ' => 'Uzbekistan',
'VU' => 'Vanuatu',
'VA' => 'Vatican City',
'VE' => 'Venezuela',
'VN' => 'Vietnam',
'WF' => 'Wallis and Futuna Islands',
'WS' => 'Western Samoa',
'YE' => 'Yemen',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe'
);
$this->countryinsure = array(
'AF' => 0,
'AL' => 0,
'DZ' => 2185,
'AD' => 5000,
'AO' => 0,
'AI' => 415,
'AG' => 60,
'AR' => 5000,
'AM' => 1350,
'AW' => 830,
'AU' => 3370,
'AT' => 5000,
'AZ' => 5000,
'BS' => 2795,
'BH' => 0,
'BD' => 5000,
'BB' => 220,
'BY' => 1323,
'BE' => 5000,
'BZ' => 1600,
'BJ' => 170,
'BM' => 440,
'BT' => 440,
'BO' => 0,
'BA' => 5000,
'BW' => 145,
'BR' => 5000,
'VG' => 165,
'BN' => 4405,
'BG' => 1030,
'BF' => 530,
'MM' => 4045,
'BI' => 790,
'KH' => 0,
'CM' => 5000,
'CA' => 675,
'CV' => 0,
'KY' => 0,
'CF' => 4405,
'TD' => 440,
'CL' => 0,
'CN' => 1130,
'CX' => 3370,
'CC' => 3370,
'CO' => 0,
'KM' => 690,
'CG' => 1685,
'ZR' => 0,
'CK' => 980,
'CR' => 0,
'CI' => 5000,
'HR' => 5000,
'CU' => 0,
'CY' => 5000,
'CZ' => 5000,
'DK' => 5000,
'DJ' => 880,
'DM' => 0,
'DO' => 0,
'TP' => 0,
'EC' => 0,
'EG' => 1685,
'SV' => 0,
'GQ' => 0,
'ER' => 0,
'EE' => 2020,
'ET' => 1000,
'FK' => 510,
'FO' => 5000,
'FJ' => 600,
'FI' => 5000,
'FR' => 5000,
'GF' => 5000,
'PF' => 1015,
'GA' => 485,
'GM' => 2575,
'GE' => 1350,
'DE' => 5000,
'GH' => 5000,
'GI' => 5000,
'GB' => 857,
'GR' => 5000,
'GL' => 5000,
'GD' => 350,
'GP' => 5000,
'GT' => 0,
'GN' => 875,
'GW' => 21,
'GY' => 10,
'HT' => 0,
'HN' => 0,
'HK' => 5000,
'HU' => 5000,
'IS' => 5000,
'IN' => 2265,
'ID' => 0,
'IR' => 0,
'IQ' => 0,
'IE' => 5000,
'IL' => 0,
'IT' => 5000,
'JM' => 0,
'JP' => 5000,
'JO' => 0,
'KZ' => 5000,
'KE' => 815,
'KI' => 0,
'KW' => 1765,
'KG' => 1350,
'LA' => 0,
'LV' => 1350,
'LB' => 440,
'LS' => 440,
'LR' => 440,
'LY' => 0,
'LI' => 5000,
'LT' => 5000,
'LU' => 5000,
'MO' => 4262,
'MK' => 2200,
'MG' => 675,
'MW' => 50,
'MY' => 1320,
'MV' => 0,
'ML' => 950,
'MT' => 5000,
'MQ' => 5000,
'MR' => 635,
'MU' => 270,
'YT' => 5000,
'MX' => 0,
'MD' => 1350,
'MC' => 5000,
'MN' => 440,
'MS' => 2200,
'MA' => 5000,
'MZ' => 0,
'NA' => 4405,
'NR' => 220,
'NP' => 0,
'NL' => 5000,
'AN' => 830,
'NC' => 1615,
'NZ' => 980,
'NI' => 440,
'NE' => 810,
'NG' => 205,
'KP' => 0,
'NO' => 0,
'OM' => 575,
'PK' => 270,
'PA' => 0,
'PG' => 445,
'PY' => 0,
'PE' => 0,
'PH' => 270,
'PN' => 0,
'PL' => 1350,
'PT' => 5000,
'QA' => 2515,
'RE' => 5000,
'RO' => 5000,
'RU' => 5000,
'RW' => 0,
'SH' => 170,
'KN' => 210,
'LC' => 400,
'PM' => 5000,
'VC' => 130,
'SM' => 5000,
'ST' => 440,
'SA' => 0,
'SN' => 865,
'YU' => 5000,
'SC' => 0,
'SL' => 0,
'SG' => 4580,
'SK' => 5000,
'SI' => 4400,
'SB' => 0,
'SO' => 440,
'ZA' => 1760,
'GS' => 510,
'KR' => 5000,
'ES' => 5000,
'LK' => 35,
'SD' => 0,
'SR' => 535,
'SZ' => 560,
'SE' => 5000,
'CH' => 5000,
'SY' => 3080,
'TW' => 1350,
'TJ' => 1350,
'TZ' => 230,
'TH' => 1350,
'TG' => 2190,
'TK' => 295,
'TO' => 515,
'TT' => 930,
'TN' => 2200,
'TR' => 880,
'TM' => 675,
'TC' => 0,
'TV' => 4715,
'UG' => 0,
'UA' => 5000,
'AE' => 5000,
'UY' => 0,
'UZ' => 5000,
'VU' => 0,
'VA' => 5000,
'VE' => 0,
'VN' => 0,
'WF' => 1615,
'WS' => 295,
'YE' => 0,
'ZM' => 540,
'ZW' => 600,
'US' => 5000
);
}
function SetInsurance()
{
$this->insurance_cost = 0;
// Insurance module by Kevin Shelton
// divide the value of the order among the packages based on the order total or subtotal depending on whether or not you have configured to insure tax
$shipping_weight = $this->order['ShippingWeight'];
$shipping_num_boxes = $this->order['ShippingNumBoxes'];
$costperpkg = $this->order['SubTotal'] / $shipping_num_boxes;
// retrieve the maximum allowed insurance for the destination country and if the package value exceeds it then set package value to the maximum allowed
$maxins = $this->countryinsure[$this->order['ShippingCountry']];
if ($costperpkg > $maxins) $costperpkg = $maxins;
// if insurance not allowed for destination or insurance is turned off add nothing to shipping cost
if (($maxins == 0) || (MODULE_SHIPPING_USPS_INSURE == 'False')) {
$insurance = 0;
}
// US and Canada share the same insurance calculation (though not the same maximum)
else if (($this->order['ShippingCountry'] == 'US') || ($this->order['ShippingCountry'] == 'CA'))
{
if ($costperpkg<=50) {
$insurance=MODULE_SHIPPING_USPS_INS1;
}
else if ($costperpkg<=100) {
$insurance=MODULE_SHIPPING_USPS_INS2;
}
else if ($costperpkg<=200) {
$insurance=MODULE_SHIPPING_USPS_INS3;
}
else if ($costperpkg<=300) {
$insurance=MODULE_SHIPPING_USPS_INS4;
}
else {
$insurance = MODULE_SHIPPING_USPS_INS4 + ((ceil($costperpkg/100) -3) * MODULE_SHIPPING_USPS_INS5);
}
}
// if insurance allowed and is not US or Canada then calculate international insurance
else {
if ($costperpkg<=50) {
$insurance=MODULE_SHIPPING_USPS_INS6;
}
else if ($costperpkg<=100) {
$insurance=MODULE_SHIPPING_USPS_INS7;
}
else if ($costperpkg<=200) {
$insurance=MODULE_SHIPPING_USPS_INS8;
}
else if ($costperpkg<=300) {
$insurance=MODULE_SHIPPING_USPS_INS9;
}
else {
$insurance = MODULE_SHIPPING_USPS_INS9 + ((ceil($costperpkg/100) - 3) * MODULE_SHIPPING_USPS_INS10);
}
}
// usps doesnt accept zero weight
$shipping_weight = ($shipping_weight < 0.1 ? 0.1 : $shipping_weight);
$shipping_pounds = floor ($shipping_weight);
$shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
$this->_setWeight($shipping_pounds, $shipping_ounces);
// Added by Kevin Chen (kkchen@uci.edu); Fixes the Parcel Post Bug July 1, 2004
// Refer to http://www.usps.com/webtools/htm/Domestic-Rates.htm documentation
// Thanks Ryan
if($shipping_pounds > 35 || ($shipping_pounds == 0 && $shipping_ounces < 6)){
$this->_setMachinable('False');
}
else{
$this->_setMachinable('True');
}
$this->insurance_cost = $insurance;
// End Kevin Chen July 1, 2004
}
function _setService($service)
{
$this->service = $service;
}
function _setWeight($pounds, $ounces=0)
{
$this->pounds = $pounds;
$this->ounces = $ounces;
}
function _setContainer($container)
{
$this->container = $container;
}
function _setSize($size)
{
$this->size = $size;
}
function _setMachinable($machinable)
{
$this->machinable = $machinable;
}
function PhoneClean($phone)
{
$res = preg_replace('/[(]|[)]|[\-]|[ ]|[#]|[\.]|[a-z](.*)|[A-Z](.*)/g', '', $phone);
if ( strlen($res) > 10 ) {
$res = substr($res, 0, 10);
}
return $res != '' ? $res : $phone;
}
function GetQuote($method = '')
{
if ( isset($this->types[$method]) || in_array($method, $this->intl_types)) {
$this->_setService($method);
}
$this -> _setContainer('None');
$this -> _setSize('REGULAR');
$this -> SetInsurance(); // ???
if ($this->order['ShippingCountry'] == $this->shipping_origin_country) {
$request='<?xml version="1.0"?>';
// PASSWORD="'.$this->usps_password.'"
$request.= '<RateV3Request USERID="'.$this->usps_userid.'">';
$services_count = 0;
if (isset($this->service)) {
$this->types = array($this->service => $this->types[$this->service]);
}
$dest_zip = str_replace(' ', '', $this->order['ShippingZip']);
$dest_zip = substr($dest_zip, 0, 5);
reset($this->types);
$allowed_types = explode(", ", MODULE_SHIPPING_USPS_TYPES);
while (list($key, $value) = each($this->types))
{
if ( !in_array($key, $allowed_types) ) continue;
$request .= '<Package ID="'.$services_count.'">'.
'<Service>'.$key.'</Service>'.
'<ZipOrigination>'.$this->store_zip5.'</ZipOrigination>'.
'<ZipDestination>'.$dest_zip.'</ZipDestination>'.
'<Pounds>'.$this->pounds.'</Pounds>'.
'<Ounces>'.$this->ounces.'</Ounces>'.
'<Size>'.$this->size.'</Size>'.
'<Machinable>'.$this->machinable.'</Machinable>'.
'</Package>';
$services_count++;
}
$request .= '</RateV3Request>';
$api_query = 'RateV3';
}
else {
$request = '<IntlRateRequest USERID="'.$this->usps_userid.'">'.
'<Package ID="0">'.
'<Pounds>'.$this->pounds.'</Pounds>'.
'<Ounces>'.$this->ounces.'</Ounces>'.
'<MailType>Package</MailType>'.
'<Country>'.$this->countries[$this->order['ShippingCountry']].'</Country>'.
'</Package>'.
'</IntlRateRequest>';
$api_query = 'IntlRate';
}
- $request = 'API='.$api_query.'&XML=' . urlencode($request);
+ $request = 'API='.$api_query.'&XML=' . kUtil::escape($request, kUtil::ESCAPE_URL);
$body = $this->PostQuery($request);
$body = str_replace(chr(146), '', $body); // for bad `
// check for errors
if (strpos($body, '<Error>') !== false) {
$errors = Array ();
preg_match_all('/<Number>(.*?)<\/Number>/s', $body, $error_numbers);
preg_match_all('/<Description>(.*?)<\/Description>/s', $body, $error_descriptions);
foreach ($error_numbers[1] as $index => $error_number) {
$errors[$index] = $error_descriptions[1][$index];
if ($this->Application->isDebugMode()) {
$errors[$index] .= ' (' . $error_number . ')';
}
}
$errors = array_unique($errors); // we may have same errors on many packages, so don't show duplicates
return Array('error' => implode('<br/>', $errors));
}
// parse response
$xml_helper = $this->Application->recallObject('kXMLHelper');
/* @var $xml_helper kXMLHelper */
$root_node =& $xml_helper->Parse($body);
/* @var $root_node kXMLNode */
$rates = Array();
// Domestic shipping
if ($this->order['ShippingCountry'] == $this->shipping_origin_country) {
$i = 0;
$postage_node =& $root_node->FindChild('Package');
do {
// $parcel_node =& $postage_node->firstChild;
$service = $postage_node->FindChildValue('MailService');
if ( $service != '' ) {
$i++;
$rates[$i] = Array();
$rates[$i]['Title'] = $service;
$rates[$i]['Rate'] = $this->insurance_cost + $postage_node->FindChildValue('Rate');
}
}
while ( $postage_node =& $postage_node->NextSibling());
}
else {
// for International Rates !!!
$allowed_types = array();
foreach( explode(", ", MODULE_SHIPPING_USPS_TYPES_INTL) as $value ) {
$allowed_types[$value] = $this->intl_types[$value];
}
$i = 0;
$service_node =& $root_node->FindChild('Service');
do {
$service = trim($service_node->FindChildValue('SvcDescription'));
if( !in_array($service, $allowed_types) ) continue;
$i++;
if ( $service_node->FindChildValue('MaxWeight') >= $this->pounds ) {
$rates[$i] = Array();
$rates[$i]['Title'] = $service;
$rates[$i]['MaxDimensions'] = $service_node->FindChildValue('MaxDimensions');
$rates[$i]['MaxWeight'] = $service_node->FindChildValue('MaxWeight');
$rates[$i]['SvcCommitments'] = $service_node->FindChildValue('SvcCommitments');
$rates[$i]['Rate'] = $this->insurance_cost + $service_node->FindChildValue('Postage');
}
}
while ( $service_node =& $service_node->NextSibling());
}
// print_r($rates);
// die('here');
return $rates;
}
function PostOrder()
{
$request='';
$base_request = '';
$this->SetInsurance();
// $this->order['ShippingCountry'] = $this->GetUSPSCountry($this->order['ShippingCountry']);
// Domestic Order
if ($this->order['ShippingCountry'] == $this->shipping_origin_country) {
// $dest_zip = str_replace(' ', '', $this->order['ShippingZip5']);
$this->order['ShippingZip5'] = substr($this->order['ShippingZip5'], 0, 5);
$WeightInOunces = floor($this->pounds * 16 + $this->ounces);
$base_request ='
<Option>1</Option>
<ImageParameters></ImageParameters>
<FromName>'.$this->store_name.'</FromName>
<FromFirm>'.$this->company_name.'</FromFirm>
<FromAddress1>'.$this->store_address1.'</FromAddress1>
<FromAddress2>'.$this->store_address2.'</FromAddress2>
<FromCity>'.$this->store_city.'</FromCity>
<FromState>'.$this->store_state.'</FromState>
<FromZip5>'.$this->store_zip5.'</FromZip5>
<FromZip4>'.$this->store_zip4.'</FromZip4>
<ToName>'.$this->order['FirstName'].' '.$this->order['LastName'].'</ToName>
<ToFirm>'.$this->order['ShippingCompany'].'</ToFirm>
<ToAddress1>'.$this->order['ShippingAddress2'].'</ToAddress1>
<ToAddress2>'.$this->order['ShippingAddress1'].'</ToAddress2>
<ToCity>'.$this->order['ShippingCity'].'</ToCity>
<ToState>'.$this->order['ShippingState'].'</ToState>
<ToZip5>'.$this->order['ShippingZip5'].'</ToZip5>
<ToZip4>'.$this->order['ShippingZip4'].'</ToZip4>
<WeightInOunces>'.$WeightInOunces.'</WeightInOunces>
<ServiceType>'.$this->order['ShippingService'].'</ServiceType>
<ImageType>PDF</ImageType>
<LabelDate>'.date('m/d/Y',time()).'</LabelDate>
<CustomerRefNo></CustomerRefNo>
<AddressServiceRequested></AddressServiceRequested>
<SenderName></SenderName><SenderEMail></SenderEMail>
<RecipientName></RecipientName>
<RecipientEMail></RecipientEMail>
';
$api_query = 'DeliveryConfirmationV3';
$xml_request = 'DeliveryConfirmationV3.0Request';
}
else {
// International Order(s)
$shipping_service = strtolower($this->order['ShippingService']);
$base_request = '<Option/>
<ImageParameters/>
<FromFirstName>'.$this->store_first_name.'</FromFirstName>
<FromLastName>'.$this->store_last_name.'</FromLastName>
<FromFirm>'.$this->company_name.'</FromFirm>
<FromAddress1>'.$this->store_address1.'</FromAddress1>
<FromAddress2>'.$this->store_address2.'</FromAddress2>
<FromCity>'.$this->store_city.'</FromCity>
<FromState>'.$this->store_state.'</FromState>
<FromZip5>'.$this->store_zip5.'</FromZip5>
<FromPhone>'.$this->PhoneClean($this->store_phone).'</FromPhone>
<ToName>'.$this->order['FirstName'].' '.$this->order['LastName'].'</ToName>
<ToFirm>'.$this->order['ShippingCompany'].'</ToFirm>
<ToAddress1></ToAddress1>
<ToAddress2>'.$this->order['ShippingAddress2'].'</ToAddress2>
<ToAddress3>'.$this->order['ShippingAddress1'].'</ToAddress3>
<ToCity>'.$this->order['ShippingCity'].'</ToCity>';
if ( $this->order['ShippingProvince'] != '' ) {
$base_request.='
<ToProvince>'.$this->order['ShippingProvince'].'</ToProvince>';
}
$base_request.='
<ToCountry>'.$this->countries[$this->order['ShippingCountry']].'</ToCountry>
<ToPostalCode>'.$this->order['ShippingZip'].'</ToPostalCode>
<ToPOBoxFlag>N</ToPOBoxFlag>
<ToPhone>'.$this->PhoneClean($this->order['ShippingPhone']).'</ToPhone>
<ToFax>'.$this->PhoneClean($this->order['ShippingFax']).'</ToFax>
<ToEmail>'.$this->order['Email'].'</ToEmail>
<ShippingContents>';
// add items
foreach ( $this->order['Items'] as $k => $value ) {
$base_request.='
<ItemDetail>
<Description>Computer Parts</Description>
<Quantity>'.$value['Qty'].'</Quantity>
<Value>'.($value['Price'] * $value['Qty']).'</Value>
<NetPounds>'.$value['NetPounds'].'</NetPounds>
<NetOunces>'.$value['NetOunces'].'</NetOunces>
<HSTariffNumber>123456</HSTariffNumber>
<CountryOfOrigin>United States</CountryOfOrigin>
</ItemDetail>';
}
// end add items
$base_request.='
</ShippingContents>
<GrossPounds>'.$this->pounds.'</GrossPounds>
<GrossOunces>'.$this->ounces.'</GrossOunces>
<ContentType>MERCHANDISE</ContentType>
<Agreement>Y</Agreement>
<InvoiceNumber>'.$this->order['InvoiceNumber'].'</InvoiceNumber>
<ImageType>PDF</ImageType>
<ImageLayout>ALLINONEFILE</ImageLayout>
<LabelDate>'.date('m/d/Y',time()).'</LabelDate>
';
if (strpos($shipping_service, 'express') !== false) {
$xml_request = 'ExpressMailIntlRequest';
$api_query = 'ExpressMailIntl';
}
elseif (strpos($shipping_service, 'priority') !== false) {
$xml_request = 'PriorityMailIntlRequest';
$api_query = 'PriorityMailIntl';
}
else {
$xml_request = 'FirstClassMailIntlRequest';
$api_query = 'FirstClassMailIntl';
}
}
$request.= '<'.$xml_request.' USERID="'.$this->usps_userid.'">';
$request.= $base_request;
$request.= '</'.$xml_request.'>';
// die($request);
- $request = 'API='.$api_query.'&XML='.urlencode($request);
+ $request = 'API='.$api_query.'&XML='.kUtil::escape($request, kUtil::ESCAPE_URL);
$body = $this->PostQuery($request, 1);
// check for errors
if (strpos($body, '<Error>') !== false) {
$errors = Array ();
preg_match_all('/<Number>(.*?)<\/Number>/s', $body, $error_numbers);
preg_match_all('/<Description>(.*?)<\/Description>/s', $body, $error_descriptions);
foreach ($error_numbers[1] as $index => $error_number) {
$errors[$index] = Array ('error_number' => $error_number, 'error_description' => $error_descriptions[1][$index]);
}
// TODO: find a way to return other error messages in same package as well
return $errors[0];
}
// parse response
$xml_helper = $this->Application->recallObject('kXMLHelper');
$root_node =& $xml_helper->Parse($body);
/* @var $root_node kXMLNode */
$Postage = 0;
$label_file = $TrackingNumber = $PostnetBarCode = '';
// Domestic shipping
if ($this->order['ShippingCountry'] == $this->shipping_origin_country ) {
$delivery_node =& $root_node->FindChild('DeliveryConfirmationV3.0Response');
do {
$TrackingNumber = $delivery_node->FindChildValue('DeliveryConfirmationNumber');
$PostnetBarCode = $delivery_node->FindChildValue('Postnet');
$DeliveryConfirmationLabel = base64_decode($delivery_node->FindChildValue('DeliveryConfirmationLabel'));
}
while ( $delivery_node =& $delivery_node->NextSibling());
}
else {
if (strpos($shipping_service, 'express') !== false) {
$node_title = 'ExpressMailIntlResponse';
}
elseif (strpos($shipping_service, 'priority') !== false) {
$node_title = 'PriorityMailIntlResponse';
}
else {
$node_title = 'FirstClassMailIntlResponse';
}
$delivery_node =& $root_node->FindChild($node_title);
$PostnetBarCode = $delivery_node->FindChildValue('BarcodeNumber');
$Postage = $delivery_node->FindChildValue('Postage');
$DeliveryConfirmationLabel = base64_decode($delivery_node->FindChildValue('LabelImage'));
}
if ( $TrackingNumber != '' ) {
$label_file = USPS_LABEL_FOLDER.$TrackingNumber.".pdf";
}
elseif ( $PostnetBarCode != '' ) {
$label_file = USPS_LABEL_FOLDER.$PostnetBarCode.".pdf";
}
if ( $label_file != '' ) {
$file_helper = $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
$file_helper->CheckFolder(USPS_LABEL_FOLDER);
if (!$handle = fopen($label_file, 'a')) echo "Cannot open file ($label_file)";
if ( @fwrite($handle, $DeliveryConfirmationLabel) === FALSE) echo "Cannot write to file ($label_file)";
}
return array('TrackingNumber' => $TrackingNumber, 'PostnetBarCode' => $PostnetBarCode, 'Postage' => $Postage);
}
function GetUSPSCountry($country, $default = 'US')
{
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
$country = $cs_helper->getCountryIso($country);
return $country == '' ? $default : $country;
}
function GetShippingQuotes($params = null)
{
$weights = kUtil::Kg2Pounds($params['packages']['0']['weight']);
$weight = '';
$weight = $weights[0];
if ( $weights[1] != '' ) {
$weight.='.'.$weights[1];
}
$country = $this->GetUSPSCountry($params['dest_country']);
$this->order = Array();
$this->order['ShippingWeight'] = $weight;
$this->order['ShippingNumBoxes'] = 1;
$this->order['ShippingZip'] = $params['dest_postal'];
$this->order['SubTotal'] = $params['amount'];
$this->order['ShippingCountry'] = $country;
$shipping_types = Array();
$rates = $this->GetQuote();
if ( !isset($rates['error']) ) {
$this->Application->RemoveVar('sqe_error');
$i = 1;
foreach ($rates as $k => $rate ) {
$shipping_types['USPS_'.$i] = Array(
'ShippingId' => 'USPS_'.$i,
'TotalCost' => $rate['Rate'],
'ShippingName' => $rate['Title'],
'Type' => '1',
'CODFlat' => '0',
'CODPercent' => '0',
'PortalGroups' => ',15,',
'InsuranceFee' => '',
'COD' => '0',
'SelectedOnly' => '0',
'Code' => $rate['Title']
);
$i++;
}
}
else {
// for Front-End (shipping screen) and Admin (Shipping Tab on editing order)
$this->Application->StoreVar('sqe_error', $rates['error']);
}
$this->Application->StoreVar('current_usps_shipping_types', serialize($shipping_types));
return $shipping_types;
}
function TrackOrder($TrackingNumber='')
{
if ( $TrackingNumber != '' ) {
// http://testing.shippingapis.com/ShippingAPITest.dll?API=TrackV2&XML=<TrackFieldRequest USERID="402INTEC7634"><TrackID ID="EJ958083578US"></TrackID></TrackFieldRequest>
$request = '<TrackRequest USERID="'.$this->usps_userid.'"><TrackID ID="'.$TrackingNumber.'"></TrackID></TrackRequest>';
$api_query = 'TrackV2';
- $request = 'API='.$api_query.'&XML='.urlencode($request);
+ $request = 'API='.$api_query.'&XML='.kUtil::escape($request, kUtil::ESCAPE_URL);
$body = $this->PostQuery($request);
// check for errors
if (strpos($body, '<Error>') !== false) {
$errors = Array ();
preg_match_all('/<Number>(.*?)<\/Number>/s', $body, $error_numbers);
preg_match_all('/<Description>(.*?)<\/Description>/s', $body, $error_descriptions);
foreach ($error_numbers[1] as $index => $error_number) {
$errors[$index] = $error_descriptions[1][$index];
if ($this->Application->isDebugMode()) {
$errors[$index] .= ' (' . $error_number . ')';
}
}
$errors = array_unique($errors); // we may have same errors on many packages, so don't show duplicates
return Array('error' => implode('<br/>', $errors));
}
$xml_helper = $this->Application->recallObject('kXMLHelper');
$root_node =& $xml_helper->Parse($body);
/* @var $root_node kXMLNode */
// Tracking Shipping
$delivery_node =& $root_node->FindChild('TrackInfo');
$TrackSummary = $delivery_node->FindChildValue('TrackSummary');
// echo ' TrackSummary ('.$TrackingNumber.') = '.$TrackSummary.'<br>';
return strpos($TrackSummary, 'delivered') !== false ? 1 : 0;
}
else
return false;
}
function ProcessTrackOrders()
{
$sql = sprintf('SELECT `OrderId`, `ShippingTracking` FROM %s WHERE `Status` > 3 AND `Delivered` = 0', TABLE_PREFIX.'Orders');
$orders = $this->Application->Conn->Query($sql);
foreach ( $orders as $k => $order ) {
// try to track order
if ( $order['ShippingTracking'] != '' && $this->TrackOrder($order['ShippingTracking']) ) {
$config = $this->Application->getUnitConfig('ord');
$update_order = sprintf("UPDATE %s SET `Delivered` = 1 WHERE %s = %s",
TABLE_PREFIX.'Orders',
$config->getIDField(),
$order[$config->getIDField()]
);
$this->Application->Conn->Query($update_order);
}
}
}
function PostQuery($request, $secure=0)
{
switch (MODULE_SHIPPING_USPS_SERVER) {
case 'production':
$usps_server = $secure > 0 ? 'https://secure.shippingapis.com' : 'http://production.shippingapis.com' ;
$api_dll = 'ShippingAPI.dll';
break;
case 'test':
$usps_server = $secure > 0 ? 'https://secure.shippingapis.com' : 'http://testing.shippingapis.com';
$api_dll = 'ShippingAPITest.dll';
break;
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $usps_server.'/'.$api_dll.'?'.$request);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$body = curl_exec($curl);
curl_close($curl);
if ($this->logFilePath) {
$fp = fopen($this->logFilePath, 'a');
if ($fp) {
$request_url = sprintf("Date %s : IP %s\n\nPost\n\n%s\n\nReplay\n\n%s\n\n",
adodb_date('m/d/Y H:i:s'),
$this->Application->getClientIp(),
$usps_server . '/' . $api_dll . '?' . urldecode($request),
$body
);
fwrite($fp, $request_url);
fclose($fp);
}
}
return $body;
}
/**
* Returns available shipping types
*
* @return Array
* @todo Get possible shipping types based on MODULE_SHIPPING_USPS_TYPES and MODULE_SHIPPING_USPS_TYPES_INTL consntants
*/
function GetAvailableTypes()
{
return Array (
Array (
'_ClassName' => get_class($this),
'_Id' => 'USPS',
'_Name' => 'USPS (Default)'
)
);
}
function LoadParams()
{
$sql = 'SELECT Properties FROM '.$this->Application->getUnitConfig('sqe')->getTableName().'
WHERE ClassName="USPS"';
$params = $this->Conn->GetOne($sql);
return unserialize($params);
}
function _prepare_xml_param($value) {
return strip_tags($value);
}
/**
* Returns virtual field names, that will be saved as properties
*
* @return Array
*/
function GetEngineFields()
{
return Array ('AccountLogin');
}
/**
* Creates new USPS order
*
* @param OrdersItem $object
* @param bool $dry_run
* @return Array
*/
function MakeOrder(&$object, $dry_run = false)
{
$ShippingInfo = unserialize($object->GetDBField('ShippingInfo'));
$ShippingCode = $USPSMethod = '';
$ShippingCountry = $this->GetUSPSCountry($object->GetDBField('ShippingCountry'));
$UserName = explode(" ", $object->GetDBField('ShippingTo'));
$item_table = TABLE_PREFIX.'OrderItems';
if ($this->Application->isAdminUser) {
// this strange contraption actually uses temp table from object (when in temp mode)
$order_table = $object->TableName;
$item_table = str_replace('Orders', 'OrderItems', $order_table);
}
$sOrder = Array (
'FirstName' => $UserName[0],
'LastName' => $UserName[1],
'ShippingCompany' => $object->GetDBField('ShippingCompany'),
'ShippingAddress1' => $object->GetDBField('ShippingAddress1'),
'ShippingAddress2' => $object->GetDBField('ShippingAddress2'),
'ShippingCity' => $object->GetDBField('ShippingCity'),
'ShippingZip' => $object->GetDBField('ShippingZip'),
'ShippingCountry' => $ShippingCountry,
'ShippingPhone' => $this->PhoneClean($object->GetDBField('ShippingPhone')),
'ShippingFax' => $this->PhoneClean($object->GetDBField('ShippingFax')),
'ShippingNumBoxes' => '1',
);
$sql = 'SELECT SUM(`Quantity` * `Weight`)
FROM ' . $item_table . '
WHERE ' . $object->IDField . ' = ' . $object->GetID();
$weight = $this->Application->Conn->GetOne($sql);
$f_weight = kUtil::Kg2Pounds($weight);
$sOrder['ShippingWeight'] = $f_weight[0].'.'.$f_weight[1];
foreach ($ShippingInfo as $k => $ShippingRow) {
$ShippingCode = $ShippingRow['Code'];
}
if ( $object->GetDBField('ShippingCountry') == 'USA' ) {
$sOrder['ShippingState'] = $object->GetDBField('ShippingState');
$USPSMethod = $ShippingCode;
unset($sOrder['ShippingZip']);
$sOrder['ShippingZip5'] = substr(trim($object->GetDBField('ShippingZip')), 0, 5);
$sOrder['ShippingZip4'] = '';
$sOrder['SubTotal'] = $object->GetDBField('SubTotal');
}
else {
$USPSMethod = array_search($ShippingCode, $this->intl_types);
$sOrder['ShippingProvince'] = '';
if ( $ShippingCountry == 'CA' ) {
$sOrder['ShippingProvince'] = $object->GetField('ShippingState');
}
// add items
$sql = 'SELECT `Quantity`, `Weight`, `Price`
FROM ' . $item_table . '
WHERE ' . $object->IDField . ' = ' . $object->GetID();
$order_items = $this->Application->Conn->Query($sql);
$i = 1;
$Items = Array();
foreach ($order_items as $k => $order_item) {
$p_weight = Array();
$p_weight = kUtil::Kg2Pounds($order_item['Weight']);
$Items[$i] = Array('Qty' => $order_item['Quantity'], 'Price' => $order_item['Price'], 'NetPounds' => $p_weight[0], 'NetOunces' => $p_weight[1]);
$i++;
}
$sOrder['Items'] = $Items;
$sOrder['InvoiceNumber'] = $object->GetDBField('OrderNumber');
}
$sOrder['ShippingService'] = $USPSMethod;
// make USPS order
$this->order = $sOrder;
$usps_data = $this->PostOrder();
// if errors
if ( array_key_exists('error_number', $usps_data) ) {
return $usps_data;
}
if ( array_key_exists('Postage', $usps_data) ) {
$ShippingPrice = '';
$ShippingPrice = $usps_data['Postage'];
}
$ShippingTracking = '';
if ( isset($usps_data['TrackingNumber']) && $usps_data['TrackingNumber'] != '' ) {
$ShippingTracking = $usps_data['TrackingNumber'];
}
if ( isset($usps_data['PostnetBarCode']) && $usps_data['PostnetBarCode'] != '' && $ShippingTracking == '' ) {
$ShippingTracking = $usps_data['PostnetBarCode'];
}
if ($dry_run == false) {
$object->SetDBField('ShippingTracking', $ShippingTracking);
$object->Update();
}
else {
$full_path = USPS_LABEL_FOLDER . $ShippingTracking . ".pdf";
if (file_exists($full_path)) {
unlink($full_path);
}
}
return $usps_data;
}
}
\ No newline at end of file
Index: branches/5.3.x/units/shipping_quote_engines/intershipper.php
===================================================================
--- branches/5.3.x/units/shipping_quote_engines/intershipper.php (revision 15898)
+++ branches/5.3.x/units/shipping_quote_engines/intershipper.php (revision 15899)
@@ -1,517 +1,517 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class Intershipper extends ShippingQuoteEngine {
var $state = Array();
var $quote = Array();
var $quotes = Array();
var $package_id;
var $box_id;
var $shipment_id;
var $FlatSurcharge = 0;
var $PercentSurcharge = 0;
function _stripTags($params)
{
foreach ($params as $param_name => $param_value) {
if (is_array($param_value)) {
$params[$param_name] = $this->_stripTags($param_value);
}
else {
$params[$param_name] = strip_tags($param_value);
}
}
return $params;
}
function BuildUrl($params = null)
{
$params = $this->_stripTags($params);
$this->shipment_id = isset($params['shipment_id']) ? $params['shipment_id'] : $this->GenerateId();
$url = 'www.intershipper.com/Interface/Intershipper/XML/v2.0/HTTP.jsp';
$uri = 'Username='. $params['AccountLogin'].
'&Password='. $params['AccountPassword'].
'&Version='. '2.0.0.0'.
'&ShipmentID='. $this->shipment_id.
'&QueryID='. $this->shipment_id.
'&TotalCarriers='. count($params['carriers']);
$i = 0;
foreach($params['carriers'] as $carrier)
{
$i++;
- $uri .= '&CarrierCode'.$i.'='. rawurlencode($carrier['name']).
- '&CarrierAccount'.$i.'='. rawurlencode($carrier['account']).
+ $uri .= '&CarrierCode'.$i.'='. kUtil::escape($carrier['name'], kUtil::ESCAPE_URL).
+ '&CarrierAccount'.$i.'='. kUtil::escape($carrier['account'], kUtil::ESCAPE_URL).
'&CarrierInvoiced'.$i.'='. $carrier['invoiced'];
}
$uri .= '&TotalClasses='. count($params['classes']);
$i = 0;
foreach($params['classes'] as $class)
{
$i++;
$uri .= '&ClassCode'.$i.'='. $class;
}
$uri .= '&DeliveryType='. 'COM'.
'&ShipMethod='. $params['ShipMethod'].
- '&OriginationName='. rawurlencode( $params['orig_name'] ).
- '&OriginationAddress1='.rawurlencode( $params['orig_addr1'] ).
- '&OriginationAddress2='.rawurlencode( $params['orig_addr2'] ).
- '&OriginationCity='. rawurlencode( $params['orig_city'] ).
- '&OriginationState='. rawurlencode( $params['orig_state'] ).
- '&OriginationPostal='. rawurlencode( $params['orig_postal'] ).
- '&OriginationCountry='. rawurlencode( $params['orig_country'] ).
-
- '&DestinationName='. rawurlencode( $params['dest_name'] ).
- '&DestinationAddress1='.rawurlencode( $params['dest_addr1'] ).
- '&DestinationAddress2='.rawurlencode( $params['dest_addr2'] ).
- '&DestinationCity='. rawurlencode( $params['dest_city'] ).
- '&DestinationState='. rawurlencode( $params['dest_state'] ).
- '&DestinationPostal='. rawurlencode( $params['dest_postal'] ).
- '&DestinationCountry='. rawurlencode( $params['dest_country'] ).
+ '&OriginationName='. kUtil::escape( $params['orig_name'], kUtil::ESCAPE_URL ).
+ '&OriginationAddress1='.kUtil::escape( $params['orig_addr1'], kUtil::ESCAPE_URL ).
+ '&OriginationAddress2='.kUtil::escape( $params['orig_addr2'], kUtil::ESCAPE_URL ).
+ '&OriginationCity='. kUtil::escape( $params['orig_city'], kUtil::ESCAPE_URL ).
+ '&OriginationState='. kUtil::escape( $params['orig_state'], kUtil::ESCAPE_URL ).
+ '&OriginationPostal='. kUtil::escape( $params['orig_postal'], kUtil::ESCAPE_URL ).
+ '&OriginationCountry='. kUtil::escape( $params['orig_country'], kUtil::ESCAPE_URL ).
+
+ '&DestinationName='. kUtil::escape( $params['dest_name'], kUtil::ESCAPE_URL ).
+ '&DestinationAddress1='.kUtil::escape( $params['dest_addr1'], kUtil::ESCAPE_URL ).
+ '&DestinationAddress2='.kUtil::escape( $params['dest_addr2'], kUtil::ESCAPE_URL ).
+ '&DestinationCity='. kUtil::escape( $params['dest_city'], kUtil::ESCAPE_URL ).
+ '&DestinationState='. kUtil::escape( $params['dest_state'], kUtil::ESCAPE_URL ).
+ '&DestinationPostal='. kUtil::escape( $params['dest_postal'], kUtil::ESCAPE_URL ).
+ '&DestinationCountry='. kUtil::escape( $params['dest_country'], kUtil::ESCAPE_URL ).
'&Currency='. 'USD'.
'&TotalPackages='. count($params['packages']);
$i = 0;
foreach($params['packages'] as $package)
{
$i++;
- $uri .= '&BoxID'.$i.'='. urlencode( $package['package_key'] ).
+ $uri .= '&BoxID'.$i.'='. kUtil::escape( $package['package_key'] , kUtil::ESCAPE_URL ).
'&Weight'.$i.'='. $package['weight'].
'&WeightUnit'.$i.'='. $package['weight_unit'].
'&Length'.$i.'='. $package['length'].
'&Width'.$i.'='. $package['width'].
'&Height'.$i.'='. $package['height'].
'&DimensionalUnit'.$i.'='. $package['dim_unit'].
'&Packaging'.$i.'='. $package['packaging'].
'&Contents'.$i.'='. $package['contents'].
'&Insurance'.$i.'='. $package['insurance'];
}
return Array('url' => $url, 'uri' => $uri);
}
function MergeParams($custom_params)
{
$params = $this->LoadParams();
$this->FlatSurcharge = $params['FlatSurcharge'];
$this->PercentSurcharge = $params['PercentSurcharge'];
if($custom_params['carriers'])
{
$params['carriers'] = $custom_params['carriers'];
}
else
{
$carrier_codes = Array('UPS', 'FDX', 'DHL', 'USP', 'ARB');
$i = 0;
foreach($carrier_codes as $carrier)
{
if(isset($params[$carrier.'Enabled']) && $params[$carrier.'Enabled'])
{
$i++;
$params['carriers'][$i]['name'] = $carrier;
$params['carriers'][$i]['account'] = $params[$carrier.'Account'];
$params['carriers'][$i]['invoiced'] = (int) $params[$carrier.'Invoiced'];
}
}
}
if($custom_params['classes'])
{
$params['classes'] = $custom_params['classes'];
}
else
{
$classes = Array('1DY', '2DY', '3DY', 'GND');
foreach($classes as $class)
{
if(isset($params[$class.'Enabled']) && $params[$class.'Enabled'])
{
$params['classes'][] = $class;
}
}
}
if (isset($custom_params['orig_addr1'])) {
$params['orig_name'] = $custom_params['orig_name'];
$params['orig_addr1'] = $custom_params['orig_addr1'];
$params['orig_addr2'] = $custom_params['orig_addr2'];
$params['orig_city'] = $custom_params['orig_city'];
$params['orig_state'] = $custom_params['orig_state'];
$params['orig_postal'] = $custom_params['orig_postal'];
$params['orig_country'] = $custom_params['orig_country'];
}
else {
$params['orig_name'] = $this->Application->ConfigValue('Comm_StoreName');
$params['orig_addr1'] = $this->Application->ConfigValue('Comm_Shipping_AddressLine1');
$params['orig_addr2'] = $this->Application->ConfigValue('Comm_Shipping_AddressLine2');
$params['orig_city'] = $this->Application->ConfigValue('Comm_Shipping_City');
$params['orig_state'] = $this->Application->ConfigValue('Comm_Shipping_State');
$params['orig_postal'] = $this->Application->ConfigValue('Comm_Shipping_ZIP');
$params['orig_country'] = $this->Application->ConfigValue('Comm_Shipping_Country');
}
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
if (strlen($params['orig_country']) == 3) {
// got 3symbol ISO code -> resolve to 2symbol ISO code
$params['orig_country'] = $cs_helper->getCountryIso( $params['orig_country'] );
}
if (strlen($params['orig_state']) != 2) {
// got state name instead of ISO code -> resolve it to ISO code
$country_iso = $cs_helper->getCountryIso($params['orig_country'], true);
$params['orig_state'] = $cs_helper->getStateIso($params['orig_state'], $country_iso);
}
if (isset($custom_params['ShipMethod'])) {
$params['ShipMethod'] = $custom_params['ShipMethod'];
}
$params['packages'] = $custom_params['packages'];
$params['dest_name'] = $custom_params['dest_name'];
$params['dest_addr1'] = $custom_params['dest_addr1'];
$params['dest_addr2'] = $custom_params['dest_addr2'];
$params['dest_city'] = $custom_params['dest_city'];
$params['dest_state'] = $custom_params['dest_state'];
$params['dest_postal'] = $custom_params['dest_postal'];
$params['dest_country'] = $custom_params['dest_country'];
if (strlen($params['dest_country']) == 3) {
// got 3symbol ISO code -> resolve to 2symbol ISO code
$params['dest_country'] = $cs_helper->getCountryIso( $params['dest_country'] );
}
if(!$params['dest_city'] || !$params['dest_country'] ||
(($params['dest_country'] == 'US' || $params['dest_country'] == 'CA') && !$params['dest_state']) ||
!$params['dest_postal'] || !$params['packages'])
{
$valid = false;
}
else
{
$valid = true;
}
return $valid ? $params : false;
}
function GenerateId()
{
static $id;
if(!$id)
{
$id = rand(0, 1000000);
}
return $id;
}
function getShipmentId()
{
return $this->shipment_id;
}
function GetShippingQuotes($params = null)
{
if(!is_array($params)) $params = unserialize($params);
$params = $this->MergeParams($params);
if($params == false)
{
trigger_error('Incorrect params given to <em>intershipper</em> engine', E_USER_WARNING);
return;
}
$target_url = $this->BuildUrl($params);
// print_r($target_url);
$depth = Array();
$xml_parser = xml_parser_create();
xml_set_element_handler( $xml_parser, Array(&$this, 'startElement'), Array(&$this, 'endElement') );
xml_set_character_data_handler( $xml_parser, Array(&$this, 'characterData') );
$curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
$curl_helper->SetPostData($target_url['uri']);
$newdata = $curl_helper->Send($target_url['url']);
$newdata = substr($newdata, strpos($newdata, '<'));
if (!xml_parse($xml_parser, $newdata, 1)) {
trigger_error(sprintf('XML error: %s at line %d'),
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser), E_USER_WARNING);
}
xml_parser_free($xml_parser);
return array_shift($this->quotes); // array_shift must be removed after!!!
}
function startElement(&$Parser, &$Elem, $Attr)
{
array_push($this->state, $Elem);
$states = implode(' ',$this->state);
//check what state we are in
if($states == 'SHIPMENT PACKAGE') {
$this->package_id = $Attr['ID'];
}
elseif($states == 'SHIPMENT PACKAGE QUOTE') {
$quote = Array('package_id' => $this->package_id, 'id' => $Attr['ID']);
}
}
function characterData($Parser, $Line)
{
$states = join (' ',$this->state);
switch($states)
{
case 'SHIPMENT ERROR':
trigger_error($error = $Line, E_USER_WARNING);
break;
case 'SHIPMENT SHIPMENTID':
$this->shipment_id = $Line;
break;
case 'SHIPMENT PACKAGE BOXID':
$this->box_id = $Line;
break;
case 'SHIPMENT PACKAGE QUOTE CARRIER NAME':
$this->quote['carrier_name'] = $Line;
break;
case 'SHIPMENT PACKAGE QUOTE CARRIER CODE':
$this->quote['carrier_code'] = $Line;
break;
case 'SHIPMENT PACKAGE QUOTE CLASS NAME':
$this->quote['class_name'] = $Line;
break;
case 'SHIPMENT PACKAGE QUOTE CLASS CODE':
$this->quote['class_code'] = $Line;
break;
case 'SHIPMENT PACKAGE QUOTE SERVICE NAME':
$this->quote['service_name'] = $Line;
break;
case 'SHIPMENT PACKAGE QUOTE SERVICE CODE':
$this->quote['service_code'] = $Line;
break;
case 'SHIPMENT PACKAGE QUOTE RATE AMOUNT':
$this->quote['amount'] = $Line / 100;
break;
default:
}
}
function endElement($Parser, $Elem)
{
$states = implode(' ',$this->state);
if ($states == 'SHIPMENT PACKAGE QUOTE') {
unset($this->quote['id']);
unset($this->quote['package_id']);
// the $key is a combo of the carrier_code and service_code
// this is the logical way to key each quote returned
$this->quote['amount'] = $this->quote['amount']*(1+$this->PercentSurcharge/100) + $this->FlatSurcharge;
$amount_plain = $this->quote['amount'] * 100;
$key = 'INTSH_'.$this->quote['carrier_code'].'_'.$this->quote['class_code'].'_'.$amount_plain;
$this->quote['ShippingId'] = $key;
$this->quote['ShippingName'] = $this->quote['carrier_code'].' - '.$this->quote['service_name'];
$this->quote['TotalCost'] = $this->quote['amount'];
$this->quotes[$this->box_id][$key] = $this->quote;
}
array_pop($this->state);
}
function LoadParams()
{
$sql = 'SELECT Properties, FlatSurcharge, PercentSurcharge FROM '.$this->Application->getUnitConfig('sqe')->getTableName().'
WHERE Name="Intershipper.com"';
$data = $this->Conn->GetRow($sql);
$params = unserialize(getArrayValue($data, 'Properties'));
return array_merge($params, array('FlatSurcharge' => $data['FlatSurcharge'], 'PercentSurcharge' => $data['PercentSurcharge']));
}
function GetAvailableTypes()
{
$params = $this->LoadParams();
$carrier_codes = Array('UPS', 'FDX', 'DHL', 'USP', 'ARB');
$classes = Array('1DY', '2DY', '3DY', 'GND');
$i = 0;
foreach($carrier_codes as $carrier)
{
if(isset($params[$carrier.'Enabled']) && $params[$carrier.'Enabled'])
{
foreach($classes as $class)
{
if(isset($params[$class.'Enabled']) && $params[$class.'Enabled'])
{
$a_type['_ClassName'] = get_class($this);
$a_type['_Id'] = 'INTSH_'.$carrier.'_'.$class;
$a_type['_Name'] = '(Intershipper) '.$carrier.' '.$class;
$ret[] = $a_type;
}
}
}
}
return $ret;
}
/**
* Returns virtual field names, that will be saved as properties
*
* @return Array
*/
function GetEngineFields()
{
return Array (
'AccountLogin',
'UPSEnabled', 'UPSAccount', 'UPSInvoiced', 'FDXEnabled', 'FDXAccount', 'FDXInvoiced',
'DHLEnabled', 'DHLAccount', 'DHLInvoiced', 'USPEnabled', 'USPAccount', 'USPInvoiced',
'ARBEnabled', 'ARBAccount', 'ARBInvoiced', '1DYEnabled', '2DYEnabled', '3DYEnabled',
'GNDEnabled', 'ShipMethod',
);
}
}
/*$params = Array(
'AccountLogin' => 'login',
'AccountPassword' => 'password',
'carriers' => Array(
Array(
'name' => 'UPS',
'account' => '',
'invoiced' => '0'
),
Array(
'name' => 'DHL',
'account' => '',
'invoiced' => '0'
),
Array(
'name' => 'FDX',
'account' => '',
'invoiced' => '0'
),
Array(
'name' => 'USP',
'account' => '',
'invoiced' => '0'
),
Array(
'name' => 'ARB',
'account' => '',
'invoiced' => '0'
),
),
'classes' => Array('1DY', '2DY', '3DY', 'GND'),
'ShipMethod' => 'DRP',
'orig_name' => 'John%20Smith',
'orig_addr1' => '2275%20Union%20Road',
'orig_city' => 'Cheektowaga',
'orig_state' => 'NY',
'orig_postal' => '14227',
'orig_country' => 'US',
// this section is required
'dest_name' => 'Vasya%20Pupkin',
'dest_addr1' => '175%20E.Hawthorn%20pkwy.',
'dest_city' => 'Vernon%20Hills',
'dest_state' => 'IL',
'dest_postal' => '60061',
'dest_country' => 'US',
// this section is required
'packages' => Array(
Array(
'package_key' => 'package1',
'weight' => '50',
'weight_unit' => 'LB',
'length' => '25',
'width' => '15',
'height' => '15',
'dim_unit' => 'IN',
'packaging' => 'BOX',
'contents' => 'OTR',
'insurance' => '0'
),
Array(
'package_key' => 'package2',
'weight' => '50',
'weight_unit' => 'LB',
'length' => '25',
'width' => '15',
'height' => '15',
'dim_unit' => 'IN',
'packaging' => 'BOX',
'contents' => 'OTR',
'insurance' => '0'
),
),
'shipment_id' => 1234;
);
*/
/*
Returns:
$quotes = Array(
'package1' =>
Array(
Array(
'id' => 'INTSH_FDX_2DY',
'type' => 'FDX',
..
'amount' => 24.24,
)
Array(
'type' => 'FDX',
..
'amount' => 24.24,
)
),
'package2' =>
Array(
Array(
'id' => 'INTSH_FDX_3DY',
'type' => 'FDX',
..
'amount' => 24.24,
)
Array(
'type' => 'FDX',
..
'amount' => 24.24,
)
),
)
*/
\ No newline at end of file
Index: branches/5.3.x/units/product_option_combinations/product_option_combinations_event_handler.php
===================================================================
--- branches/5.3.x/units/product_option_combinations/product_option_combinations_event_handler.php (revision 15898)
+++ branches/5.3.x/units/product_option_combinations/product_option_combinations_event_handler.php (revision 15899)
@@ -1,443 +1,445 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class ProductOptionCombinationsEventHandler extends kDBEventHandler {
/**
* Apply custom processing to item
*
* @param kEvent $event
* @param string $type
* @return void
* @access protected
*/
protected function customProcessing(kEvent $event, $type)
{
if ( $type == 'after' ) {
return;
}
switch ($event->Name) {
case 'OnCreate':
case 'OnUpdate':
$object = $event->getObject();
/* @var $object kDBItem */
$options = unserialize($object->GetDBField('Combination'));
ksort($options);
$object->SetDBField('CombinationCRC', kUtil::crc32(serialize($options)));
break;
case 'OnMassDelete':
// delete only option combinations that has no associated inventory
$object = $event->getObject();
/* @var $object kDBItem */
$ids = $event->getEventParam('ids');
$sql = 'SELECT ' . $object->IDField . '
FROM ' . $object->TableName . '
WHERE (' . $object->IDField . ' IN (' . implode(',', $ids) . ')) AND
(QtyInStock = 0) AND (QtyReserved = 0) AND (QtyBackOrdered = 0) AND (QtyOnOrder = 0)';
$event->setEventParam('ids', $this->Conn->GetCol($sql));
break;
}
}
/**
* GetOptionValues
*
* @param kEvent $event
*/
function GetOptionValues($event, $option_id)
{
$object = $event->getObject();
if ($object->IsTempTable()) {
$table = $this->Application->GetTempName(TABLE_PREFIX.'ProductOptions', 'prefix:'.$event->Prefix);
}
else {
$table = TABLE_PREFIX.'ProductOptions';
}
$query = 'SELECT `Values` FROM '.$table.' WHERE ProductOptionId = '.$option_id;
return explode(',', $this->Conn->GetOne($query));
}
function CreateCombinations($event, $fields, $current_option=null)
{
$recursed = false;
$combination = $fields['Combination'];
foreach ($combination as $option_id => $option)
{
if ($option_id == $current_option || $recursed) continue;
if ($option == '_ANY_') {
$recursed = true;
$values = $this->GetOptionValues($event, $option_id);
foreach ($values as $a_value) {
$fields['Combination'][$option_id] = $a_value;
$this->CreateCombinations($event, $fields, $option_id);
}
}
}
if (!$recursed) {
$object = $event->getObject();
/* @var $object kDBItem */
$salt = $fields['Combination'];
ksort($salt);
$object->Load(kUtil::crc32(serialize($salt)), 'CombinationCRC');
$object->SetFieldsFromHash($fields);
$this->customProcessing($event,'before');
if ( $object->isLoaded() ) { // Update if such combination already exists
if( $object->Update() )
{
$this->customProcessing($event,'after');
$event->status=kEvent::erSUCCESS;
}
}
else {
if( $object->Create($event->getEventParam('ForceCreateId')) )
{
$this->customProcessing($event,'after');
$event->status=kEvent::erSUCCESS;
}
}
}
}
function UpdateCombinations($event, $fields, $current_option=null)
{
$recursed = false;
$combination = $fields['Combination'];
foreach ($combination as $option_id => $option)
{
if ($option_id == $current_option || $recursed) continue;
if ($option == '_ANY_') {
$recursed = true;
$values = $this->GetOptionValues($event, $option_id);
foreach ($values as $a_value) {
$fields['Combination'][$option_id] = $a_value;
$this->UpdateCombinations($event, $fields, $option_id);
}
}
}
if (!$recursed) {
$object = $event->getObject();
/* @var $object kDBItem */
$edit_id = $object->GetId();
$salt = $fields['Combination'];
ksort($salt);
// try to load combination by salt - if loaded, it will update the combination
$object->Load(kUtil::crc32(serialize($salt)), 'CombinationCRC');
if ( !$object->isLoaded() ) {
$object->Load($edit_id);
}
$object->SetFieldsFromHash($fields);
$this->customProcessing($event,'before');
if( $object->Update() )
{
$this->customProcessing($event,'after');
$event->status=kEvent::erSUCCESS;
}
}
}
/**
* Creates new kDBItem
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCreate(kEvent $event)
{
$object = $event->getObject(Array ('skip_autoload' => true));
/* @var $object kDBItem */
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( !$items_info ) {
return;
}
list($id, $field_values) = each($items_info);
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
+ $event->setEventParam('form_data', $field_values);
if ( !$object->Validate() ) {
$event->status = kEvent::erFAIL;
$event->redirect = false;
$this->Application->SetVar($event->getPrefixSpecial() . '_SaveEvent', 'OnCreate');
$object->setID($id);
return;
}
$this->CreateCombinations($event, $field_values);
}
/**
* Updates kDBItem
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnUpdate(kEvent $event)
{
$object = $event->getObject( Array('skip_autoload' => true) );
/* @var $object kDBItem */
$items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
if($items_info)
{
foreach($items_info as $id => $field_values)
{
$object->Load($id);
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
+ $event->setEventParam('form_data', $field_values);
if (!$object->Validate()) {
$event->status = kEvent::erFAIL;
$event->redirect = false;
return;
}
$this->UpdateCombinations($event, $field_values);
/*$this->customProcessing($event, 'before');
if( $object->Update($id) )
{
$this->customProcessing($event, 'after');
$event->status=kEvent::erSUCCESS;
}
else
{
$event->status=kEvent::erFAIL;
$event->redirect=false;
break;
}*/
}
}
$this->Application->SetVar($event->GetPrefixSpecial().'_id', '');
}
/**
* Builds item (loads if needed)
*
* Pattern: Prototype Manager
*
* @param kEvent $event
* @access protected
*/
protected function OnItemBuild(kEvent $event)
{
$object = $event->getObject();
/* @var $object kDBItem */
$this->dbBuild($object, $event);
$sql = $this->ItemPrepareQuery($event);
$sql = $this->Application->ReplaceLanguageTags($sql);
$object->setSelectSQL($sql);
// 2. loads if allowed
$auto_load = $event->getUnitConfig()->getAutoLoad();
$skip_autoload = $event->getEventParam('skip_autoload');
if ( $auto_load && !$skip_autoload ) {
$this->LoadItem($event);
}
$actions = $this->Application->recallObject('kActions');
/* @var $actions Params */
$actions->Set($event->getPrefixSpecial() . '_GoTab', '');
$actions->Set($event->getPrefixSpecial() . '_GoId', '');
}
/**
* Load item if id is available
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function LoadItem(kEvent $event)
{
$object = $event->getObject();
/* @var $object kDBItem */
$id = $this->getPassedID($event);
if ( !$id ) {
$event->CallSubEvent('OnNew');
return;
}
if ( $object->Load($id) ) {
$actions = $this->Application->recallObject('kActions');
/* @var $actions Params */
$actions->Set($event->getPrefixSpecial() . '_id', $object->GetId());
}
}
/**
* Returns special of main item for linking with sub-item
*
* @param kEvent $event
* @return string
* @access protected
*/
protected function getMainSpecial(kEvent $event)
{
$special = $event->getEventParam('main_special');
if ( $special === false || $special == '$main_special' ) {
$special = $event->Special;
}
if ( $special == 'grid' ) {
$special = '';
}
return $special;
}
/**
* Occurs before an item has been cloned
* Id of newly created item is passed as event' 'id' param
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeClone(kEvent $event)
{
parent::OnBeforeClone($event);
$event->Init($event->Prefix, '-item');
$object = $event->getObject();
/* @var $object kDBItem */
$options_mapping = $this->Application->GetVar('poc_mapping');
if ( !$options_mapping ) {
return;
}
foreach ($options_mapping as $original => $new) {
$n_combs = array ();
$comb_data = unserialize($object->GetDBField('Combination'));
foreach ($comb_data as $key => $val) {
$n_key = $key == $original ? $new : $key;
$n_combs[$n_key] = $val;
}
ksort($n_combs);
$n_combs = serialize($n_combs);
$n_crc = kUtil::crc32($n_combs);
$object->SetDBField('Combination', $n_combs);
$object->SetDBField('CombinationCRC', $n_crc);
}
}
/**
* Restore back values from live table to temp table before overwriting live with temp
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeDeleteFromLive(kEvent $event)
{
parent::OnBeforeDeleteFromLive($event);
// check if product inventory management is via options and then proceed
$id = $event->getEventParam('id');
$products_table = $this->Application->getUnitConfig('p')->getTableName();
$config = $event->getUnitConfig();;
$sql = 'SELECT p.InventoryStatus
FROM ' . $products_table . ' p
LEFT JOIN ' . $config->getTableName() . ' poc ON poc.ProductId = p.ProductId
WHERE poc.' . $config->getIDField() . ' = ' . $id;
$inventory_status = $this->Conn->GetOne($sql);
if ( $inventory_status == ProductInventory::BY_OPTIONS ) {
$live_object = $this->Application->recallObject($event->Prefix . '.itemlive', null, Array ('skip_autoload' => true));
/* @var $live_object kDBItem */
$live_object->SwitchToLive();
$live_object->Load($id);
$temp_object = $this->Application->recallObject($event->Prefix . '.itemtemp', null, Array ('skip_autoload' => true));
/* @var $temp_object kDBItem */
$temp_object->SwitchToTemp();
$temp_object->Load($id);
$temp_object->SetDBFieldsFromHash($live_object->GetFieldValues(), null, Array ('QtyInStock', 'QtyReserved', 'QtyBackOrdered', 'QtyOnOrder'));
$temp_object->Update();
}
}
/**
* Create search filters based on search query
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnSearch(kEvent $event)
{
parent::OnSearch($event);
$this->_saveProduct($event);
}
/**
* Clear search keywords
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnSearchReset(kEvent $event)
{
parent::OnSearchReset($event);
$this->_saveProduct($event);
}
/**
* Makes event remember product id (if passed)
*
* @param kEvent $event
*/
function _saveProduct($event)
{
$product_id = $this->Application->GetVar('p_id');
if ($product_id) {
$event->SetRedirectParam('p_id', $product_id);
}
}
}
\ No newline at end of file
Index: branches/5.3.x/units/product_option_combinations/product_option_combinations_config.php
===================================================================
--- branches/5.3.x/units/product_option_combinations/product_option_combinations_config.php (revision 15898)
+++ branches/5.3.x/units/product_option_combinations/product_option_combinations_config.php (revision 15899)
@@ -1,148 +1,148 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'poc',
'ItemClass' => Array ('class' => 'kPOCItem', 'file' => 'products_option_combination_item.php', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'ProductOptionCombinationsEventHandler', 'file' => 'product_option_combinations_event_handler.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'ProductOptionCombinationsTagProcessor', 'file' => 'product_option_combinations_tag_processor.php', 'build_event' => 'OnBuild'),
'RegisterClasses' => Array (
Array ('pseudo' => 'kCombinationFormatter', 'class' => 'kCombinationFormatter', 'file' => 'product_option_formatters.php', 'build_event' => ''),
Array ('pseudo' => 'kCombPriceFormatter', 'class' => 'kCombPriceFormatter', 'file' => 'product_option_formatters.php', 'build_event' => ''),
),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
),
'TitleField' => 'CombinationId',
'IDField' => 'CombinationId',
'TableName' => TABLE_PREFIX.'ProductOptionCombinations',
'ForeignKey' => Array ('p' => 'ProductId'),
'ParentTableKey' => Array ('p' => 'ProductId'),
'ParentPrefix' => 'p',
'AutoDelete' => true,
'AutoClone' => true,
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Products ON '.TABLE_PREFIX.'Products.ProductId = %1$s.ProductId
LEFT JOIN '.TABLE_PREFIX.'ProductsPricing ON '.TABLE_PREFIX.'ProductsPricing.ProductId = %1$s.ProductId AND '.TABLE_PREFIX.'ProductsPricing.IsPrimary = 1',
),
'ItemSQLs' => Array (
'' => ' SELECT *
FROM %s',
),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('Combination' => 'asc'),
'ForcedSorting' => Array ('Priority' => 'desc'),
)
),
'Fields' => Array (
'CombinationId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0, ),
'ProductId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0, ),
'Combination' => Array ('type' => 'string', 'required' => 1, 'formatter' => 'kCombinationFormatter', 'format' =>"%s: %s<br>", 'default' => NULL),
- 'CombinationCRC' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0, ),
+ 'CombinationCRC' => Array ('type' => 'string', 'not_null' => 1, 'default' => 0, ),
'PriceType' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Txt_=', 2 => 'la_Flat', 3 => 'la_Percent'), 'use_phrases' => 1, 'default' => 3, ),
'Price' => Array ('type' => 'float', 'required' => 1, 'formatter' => 'kFormatter', 'default' => '', ),
'WeightType' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Txt_=', 2 => 'la_Flat', 3 => 'la_Percent'), 'use_phrases' => 1, 'default' => 3, ),
'Weight' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'default' => 0, ),
'Availability' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array ( 0 => 'la_No', 1 => 'la_Yes', ), 'use_phrases' => 1,
'not_null' => 1, 'default' => 1,
),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0, ),
'QtyInStock' => Array ('type' => 'int', 'not_null' => '1', 'default' => 0),
'QtyReserved' => Array ('type' => 'int', 'not_null' => '1', 'default' => 0),
'QtyBackOrdered' => Array ('type' => 'int', 'not_null' => '1', 'default' => 0),
'QtyOnOrder' => Array ('type' => 'int', 'not_null' => '1', 'default' => 0),
'SKU' => Array ('type' => 'string', 'not_null' => '1', 'default' => ''),
),
'CalculatedFields' => Array (
'' => Array (
'FinalPrice' => 'IF(%1$s.PriceType = 1, %1$s.Price,
IF(%1$s.PriceType = 2, '.TABLE_PREFIX.'ProductsPricing.Price + %1$s.Price,
'.TABLE_PREFIX.'ProductsPricing.Price * (1 + %1$s.Price/100)
)
)',
'BasePrice' => TABLE_PREFIX.'ProductsPricing.Price',
),
),
'VirtualFields' => Array (
'FinalPrice' => Array ('type' => 'float', 'formatter' => 'kCombPriceFormatter', 'format' => '%.2f', 'default' => NULL),
'BasePrice' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%.2f', 'default' => NULL),
),
'Grids' => Array (
'Default' => Array (
'Icons' => Array (
'default' => 'icon16_item.png',
'module' => 'core',
),
'Fields' => Array (
'Combination' => Array ( 'title' => 'la_col_Combination', 'data_block' => 'grid_combination_td', 'filter_block' => 'grid_empty_filter'),
'SKU' => Array ( 'filter_block' => 'grid_like_filter'),
'Availability' => Array ( 'filter_block' => 'grid_options_filter'),
'Price' => Array ( 'data_block' => 'price_td', 'filter_block' => 'grid_range_filter'),
// 'Weight' => Array ( 'data_block' => 'weight_td', 'filter_block' => 'grid_range_filter'),
),
),
'Inventory' => Array (
'Icons' => Array (
'default' => 'icon16_item.png',
'module' => 'core',
),
'Selector' => 'radio',
'Fields' => Array (
'Combination' => Array ('title' => 'la_col_Combination', 'data_block' => 'grid_combination_td', 'filter_block' => 'grid_empty_filter'),
'SKU' => Array ('filter_block' => 'grid_like_filter'),
'QtyInStock' => Array ('filter_block' => 'grid_range_filter'),
'QtyReserved' => Array ('filter_block' => 'grid_range_filter'),
'QtyBackOrdered' => Array ('filter_block' => 'grid_range_filter'),
'QtyOnOrder' => Array ('filter_block' => 'grid_range_filter'),
),
),
'Radio' => Array (
'Selector' => 'radio',
'Icons' => Array (
'default' => 'icon16_item.png',
'module' => 'core',
),
'Fields' => Array (
'Combination' => Array ( 'title' => 'la_col_Combination', 'data_block' => 'grid_combination_td', 'filter_block' => 'grid_empty_filter'),
'FinalPrice' => Array ( 'title' => 'column:la_fld_Price', 'data_block' => 'grid_data_td', 'currency' => 'primary', 'filter_block' => 'grid_range_filter'),
// 'Weight' => Array ('data_block' => 'weight_td', 'filter_block' => 'grid_range_filter'),
),
),
),
);
\ No newline at end of file
Index: branches/5.3.x/units/shipping_costs/shipping_costs_event_handler.php
===================================================================
--- branches/5.3.x/units/shipping_costs/shipping_costs_event_handler.php (revision 15898)
+++ branches/5.3.x/units/shipping_costs/shipping_costs_event_handler.php (revision 15899)
@@ -1,299 +1,300 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class ShippingCostsEventHandler extends kDBEventHandler {
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array(
'OnPropagate' => Array('subitem' => 'add|edit'),
'OnClearAll' => Array('subitem' => 'add|edit'),
'OnSaveCreated' => Array('subitem' => 'add|edit'),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Creates new kDBItem
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnCreate(kEvent $event)
{
$object = $event->getObject(Array ('skip_autoload' => true));
/* @var $object kDBItem */
$zones_object = $this->Application->recallObject('z');
$sql = 'SELECT ZoneID
FROM ' . $zones_object->TableName . '
WHERE ShippingTypeID = ' . $this->Application->GetVar('s_id');
$res = $this->Conn->GetCol($sql);
$sql = 'DELETE FROM ' . $object->TableName . '
WHERE ZoneID IN (' . implode(',', $res) . ')';
$this->Conn->Query($sql);
// creates multiple db records from single request (OnCreate event only creates 1 record)
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( !$items_info ) {
return;
}
foreach ($items_info as $field_values) {
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
+ $event->setEventParam('form_data', $field_values);
$this->customProcessing($event, 'before');
if ( $object->Create() ) {
$this->customProcessing($event, 'after');
$event->status = kEvent::erSUCCESS;
}
else {
$event->status = kEvent::erFAIL;
$event->redirect = false;
$this->Application->SetVar($event->getPrefixSpecial() . '_SaveEvent', 'OnCreate');
$object->setID(0);
}
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnPropagate($event)
{
// $this->OnCreate($event);
$object = $event->getObject();
$shipping_object = $this->Application->recallObject('s');
if( $this->Application->GetVar('br_propagate_id') )
{
$propagate_id = $this->Application->GetVar('br_propagate_id');
$idfield = 'BracketId';
}
else
{
$propagate_id = $this->Application->GetVar('z_propagate_id');
$idfield = 'ZoneID';
}
$cost_type = $shipping_object->GetDBField('CostType');
switch($cost_type)
{
case 1:
$affected_fields = Array(0 => 'Flat');
break;
case 2:
$affected_fields = Array(0 => 'PerUnit');
break;
default:
$affected_fields = Array(0 => 'PerUnit', 1 => 'Flat');
break;
}
$sql = 'SELECT ShippingCostId,'.implode(',', $affected_fields).'
FROM '.$object->TableName.'
WHERE '.$idfield.'='.$propagate_id;
$res = $this->Conn->Query($sql);
if(is_array($res))
{
$res = array_reverse($res);
foreach($affected_fields as $field)
{
$first_elem = getArrayValue($res, 0);
if( (double)$first_elem[$field] )
{
$iterating_value = $first_elem[$field];
$second_elem = getArrayValue($res, 1);
if( is_array($second_elem) && (double)$second_elem[$field] )
{
$increment = $second_elem[$field] - $first_elem[$field];
}
else
{
$increment = 0;
}
foreach($res as $record)
{
$object->Load($record['ShippingCostId']);
$new_value = ($iterating_value >= 0) ? $iterating_value : null;
$object->SetDBField($field, $new_value);
$object->Update();
$iterating_value += $increment;
}
}
}
}
/*$shipping_event = new kEvent('s:OnPreSave');
$shipping_event->status = kEvent::erFATAL;
$this->Application->HandleEvent($shipping_event);*/
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnClearAll($event)
{
$object = $event->getObject(Array ('skip_autoload' => true));
/* @var $object kDBItem */
$zones_object = $this->Application->recallObject('z');
/* @var $zones_object kDBItem */
$sql = 'SELECT ZoneID
FROM ' . $zones_object->TableName . '
WHERE ShippingTypeID = ' . $this->Application->GetVar('s_id');
$res = $this->Conn->GetCol($sql);
$sql = 'DELETE FROM ' . $object->TableName . '
WHERE ZoneID IN (' . implode(',', $res) . ')';
$this->Conn->Query($sql);
$event->setRedirectParams(Array ('opener' => 's', 'pass_events' => false));
$event->status = kEvent::erSUCCESS;
}
/**
* Apply custom processing to item
*
* @param kEvent $event
* @param string $type
* @return void
* @access protected
*/
protected function customProcessing(kEvent $event, $type)
{
if ( $type == 'before' && $this->Application->GetVar('sc') ) {
$shipping_obj = $this->Application->recallObject('s');
/* @var $shipping_obj kDBItem */
$object = $event->getObject();
/* @var $object kDBItem */
$zero_if_empty = $shipping_obj->GetDBField('ZeroIfEmpty');
if ( $object->GetDBField('Flat') == '' ) {
$flat = $zero_if_empty ? 0 : null;
$object->SetDBField('Flat', $flat);
}
if ( $object->GetDBField('PerUnit') == '' ) {
$per_unit = $zero_if_empty ? 0 : null;
$object->SetDBField('PerUnit', $per_unit);
}
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnSaveCreated($event)
{
$event->CallSubEvent('OnCreate');
$event->redirect = false;
$event->setRedirectParams(Array ('opener' => 's', 'pass' => 'all'));
}
/**
* Occurs after an item has been copied to temp
* Id of copied item is passed as event' 'id' param
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterCopyToTemp(kEvent $event)
{
parent::OnAfterCopyToTemp($event);
$id = $event->getEventParam('id');
$object = $this->Application->recallObject($event->Prefix . '.-item', $event->Prefix);
/* @var $object kDBItem */
$object->SwitchToTemp();
$object->Load($id);
$shipping_obj = $this->Application->recallObject('s');
/* @var $shipping_obj kDBItem */
$lang_object = $this->Application->recallObject('lang.current');
/* @var $lang_object LanguagesItem */
// by weight and US/UK system - we need to store recalculated price per Kg cause shipping calculation is done per Kg!
if ( $shipping_obj->GetDBField('Type') == 1 && $lang_object->GetDBField('UnitSystem') == 2 ) {
$object->SetDBField('PerUnit', $object->GetDBField('PerUnit') * kUtil::POUND_TO_KG);
$object->Update(null, null, true);
}
}
/**
* Occurs before an item is copied to live table (after all foreign keys have been updated)
* Id of item being copied is passed as event' 'id' param
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeCopyToLive(kEvent $event)
{
parent::OnBeforeCopyToLive($event);
$id = $event->getEventParam('id');
$object = $this->Application->recallObject($event->Prefix . '.-item', $event->Prefix);
/* @var $object kDBItem */
$object->SwitchToTemp();
$object->Load($id);
$shipping_obj = $this->Application->recallObject('s');
/* @var $shipping_obj kDBItem */
$lang_object = $this->Application->recallObject('lang.current');
/* @var $lang_object LanguagesItem */
// by weight and US/UK system - we need to store recalculated price per Kg cause shipping calculation is done per Kg!
if ( $shipping_obj->GetDBField('Type') == 1 && $lang_object->GetDBField('UnitSystem') == 2 ) {
$object->SetDBField('PerUnit', $object->GetDBField('PerUnit') / kUtil::POUND_TO_KG);
$object->Update(null, null, true);
}
}
}
\ No newline at end of file
Index: branches/5.3.x/units/orders/orders_event_handler.php
===================================================================
--- branches/5.3.x/units/orders/orders_event_handler.php (revision 15898)
+++ branches/5.3.x/units/orders/orders_event_handler.php (revision 15899)
@@ -1,4021 +1,4025 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class OrdersEventHandler extends kDBEventHandler
{
/**
* Checks user permission to execute given $event
*
* @param kEvent $event
* @return bool
* @access public
*/
public function CheckPermission(kEvent $event)
{
if ( !$this->Application->isAdminUser ) {
if ( $event->Name == 'OnCreate' ) {
// user can't initiate custom order creation directly
return false;
}
$user_id = $this->Application->RecallVar('user_id');
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( $items_info ) {
// when POST is present, then check when is beeing submitted
$order_session_id = $this->Application->RecallVar($event->getPrefixSpecial(true) . '_id');
$order_dummy = $this->Application->recallObject($event->Prefix . '.-item', null, Array ('skip_autoload' => true));
/* @var $order_dummy OrdersItem */
foreach ($items_info as $id => $field_values) {
if ( $order_session_id != $id ) {
// user is trying update not his order, even order from other guest
return false;
}
$order_dummy->Load($id);
// session_id matches order_id from submit
if ( $order_dummy->GetDBField('PortalUserId') != $user_id ) {
// user performs event on other user order
return false;
}
$status_field = $event->getUnitConfig()->getStatusField(true);
if ( isset($field_values[$status_field]) && $order_dummy->GetDBField($status_field) != $field_values[$status_field] ) {
// user can't change status by himself
return false;
}
if ( $order_dummy->GetDBField($status_field) != ORDER_STATUS_INCOMPLETE ) {
// user can't edit orders being processed
return false;
}
if ( $event->Name == 'OnUpdate' ) {
// all checks were ok -> it's user's order -> allow to modify
return true;
}
}
}
}
if ( $event->Name == 'OnQuietPreSave' ) {
$section = $event->getSection();
if ( $this->isNewItemCreate($event) ) {
return $this->Application->CheckPermission($section . '.add', 1);
}
else {
return $this->Application->CheckPermission($section . '.add', 1) || $this->Application->CheckPermission($section . '.edit', 1);
}
}
return parent::CheckPermission($event);
}
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
// admin
'OnRecalculateItems' => Array('self' => 'add|edit'),
'OnResetToUser' => Array('self' => 'add|edit'),
'OnResetToBilling' => Array('self' => 'add|edit'),
'OnResetToShipping' => Array('self' => 'add|edit'),
'OnMassOrderApprove' => Array('self' => 'advanced:approve'),
'OnMassOrderDeny' => Array('self' => 'advanced:deny'),
'OnMassOrderArchive' => Array('self' => 'advanced:archive'),
'OnMassPlaceOrder' => Array('self' => 'advanced:place'),
'OnMassOrderProcess' => Array('self' => 'advanced:process'),
'OnMassOrderShip' => Array('self' => 'advanced:ship'),
'OnResetToPending' => Array('self' => 'advanced:reset_to_pending'),
'OnLoadSelected' => Array('self' => 'view'), // print in this case
'OnGoToOrder' => Array('self' => 'view'),
// front-end
'OnViewCart' => Array('self' => true),
'OnAddToCart' => Array('self' => true),
'OnRemoveFromCart' => Array('self' => true),
'OnUpdateCart' => Array('self' => true),
'OnUpdateCartJSON' => Array('self' => true),
'OnUpdateItemOptions' => Array('self' => true),
'OnCleanupCart' => Array('self' => true),
'OnContinueShopping' => Array('self' => true),
'OnCheckout' => Array('self' => true),
'OnSelectAddress' => Array('self' => true),
'OnProceedToBilling' => Array('self' => true),
'OnProceedToPreview' => Array('self' => true),
'OnCompleteOrder' => Array('self' => true),
'OnUpdateAjax' => Array('self' => true),
'OnRemoveCoupon' => Array('self' => true),
'OnRemoveGiftCertificate' => Array('self' => true),
'OnCancelRecurring' => Array('self' => true),
'OnAddVirtualProductToCart' => Array('self' => true),
'OnItemBuild' => Array('self' => true),
'OnDownloadLabel' => Array('self' => true, 'subitem' => true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Define alternative event processing method names
*
* @return void
* @see kEventHandler::$eventMethods
* @access protected
*/
protected function mapEvents()
{
parent::mapEvents();
$common_events = Array (
'OnResetToUser' => 'OnResetAddress',
'OnResetToBilling' => 'OnResetAddress',
'OnResetToShipping' => 'OnResetAddress',
'OnMassOrderProcess' => 'MassInventoryAction',
'OnMassOrderApprove' => 'MassInventoryAction',
'OnMassOrderDeny' => 'MassInventoryAction',
'OnMassOrderArchive' => 'MassInventoryAction',
'OnMassOrderShip' => 'MassInventoryAction',
'OnOrderProcess' => 'InventoryAction',
'OnOrderApprove' => 'InventoryAction',
'OnOrderDeny' => 'InventoryAction',
'OnOrderArchive' => 'InventoryAction',
'OnOrderShip' => 'InventoryAction',
);
$this->eventMethods = array_merge($this->eventMethods, $common_events);
}
/* ======================== FRONT ONLY ======================== */
function OnQuietPreSave($event)
{
$object = $event->getObject();
/* @var $object kDBItem */
$object->IgnoreValidation = true;
$event->CallSubEvent('OnPreSave');
$object->IgnoreValidation = false;
}
/**
* Sets new address to order
*
* @param kEvent $event
*/
function OnSelectAddress($event)
{
if ($this->Application->isAdminUser) {
return ;
}
$object = $event->getObject();
/* @var $object OrdersItem */
$shipping_address_id = $this->Application->GetVar('shipping_address_id');
$billing_address_id = $this->Application->GetVar('billing_address_id');
if ($shipping_address_id || $billing_address_id) {
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
$address = $this->Application->recallObject('addr.-item','addr', Array('skip_autoload' => true));
/* @var $address AddressesItem */
$addr_list = $this->Application->recallObject('addr', 'addr_List', Array('per_page'=>-1, 'skip_counting'=>true) );
/* @var $addr_list AddressesList */
$addr_list->Query();
}
if ($shipping_address_id > 0) {
$addr_list->CopyAddress($shipping_address_id, 'Shipping');
$address->Load($shipping_address_id);
$address->MarkAddress('Shipping');
$cs_helper->PopulateStates($event, 'ShippingState', 'ShippingCountry');
$object->setRequired('ShippingState', false);
}
elseif ($shipping_address_id == -1) {
$object->ResetAddress('Shipping');
}
if ($billing_address_id > 0) {
$addr_list->CopyAddress($billing_address_id, 'Billing');
$address->Load($billing_address_id);
$address->MarkAddress('Billing');
$cs_helper->PopulateStates($event, 'BillingState', 'BillingCountry');
$object->setRequired('BillingState', false);
}
elseif ($billing_address_id == -1) {
$object->ResetAddress('Billing');
}
$event->redirect = false;
$object->IgnoreValidation = true;
$this->RecalculateTax($event);
$object->Update();
}
/**
* Updates order with registred user id
*
* @param kEvent $event
*/
function OnUserCreate($event)
{
if( !($event->MasterEvent->status == kEvent::erSUCCESS) ) return false;
$ses_id = $this->Application->RecallVar('front_order_id');
if($ses_id)
{
$this->updateUserID($ses_id, $event);
$this->Application->RemoveVar('front_order_id');
}
}
/**
* Updates shopping cart with logged-in user details
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnUserLogin($event)
{
if ( ($event->MasterEvent->status != kEvent::erSUCCESS) || kUtil::constOn('IS_INSTALL') ) {
// login failed OR login during installation
return;
}
$ses_id = $this->Application->RecallVar('ord_id');
if ( $ses_id ) {
$this->updateUserID($ses_id, $event);
}
$user_id = $this->Application->RecallVar('user_id');
$affiliate_id = $this->isAffiliate($user_id);
if ( $affiliate_id ) {
$this->Application->setVisitField('AffiliateId', $affiliate_id);
}
$event->CallSubEvent('OnRecalculateItems');
}
/**
* Puts ID of just logged-in user into current order
*
* @param int $order_id
* @param kEvent $event
* @return void
*/
function updateUserID($order_id, $event)
{
$user = $this->Application->recallObject('u.current');
/* @var $user UsersItem */
$affiliate_id = $this->isAffiliate( $user->GetID() );
$fields_hash = Array (
'PortalUserId' => $user->GetID(),
'BillingEmail' => $user->GetDBField('Email'),
);
if ( $affiliate_id ) {
$fields_hash['AffiliateId'] = $affiliate_id;
}
$config = $event->getUnitConfig();
$this->Conn->doUpdate($fields_hash, $config->getTableName(), $config->getIDField() . ' = ' . $order_id);
$object = $event->getObject();
/* @var $object kDBItem */
// set user id to object, since it will be used during order update from OnRecalculateItems event
$object->SetDBField('PortalUserId', $user->GetID());
}
function isAffiliate($user_id)
{
$affiliate_user = $this->Application->recallObject('affil.-item', null, Array('skip_autoload' => true) );
/* @var $affiliate_user kDBItem */
$affiliate_user->Load($user_id, 'PortalUserId');
return $affiliate_user->isLoaded() ? $affiliate_user->GetDBField('AffiliateId') : 0;
}
/**
* Charge order
*
* @param OrdersItem $order
* @return Array
*/
function ChargeOrder(&$order)
{
$gw_data = $order->getGatewayData();
$this->Application->registerClass( $gw_data['ClassName'], GW_CLASS_PATH.'/'.$gw_data['ClassFile'] );
$gateway_object = $this->Application->recallObject( $gw_data['ClassName'] );
/* @var $gateway_object kGWBase */
$payment_result = $gateway_object->DirectPayment($order->GetFieldValues(), $gw_data['gw_params']);
$sql = 'UPDATE %s SET GWResult1 = %s WHERE %s = %s';
$sql = sprintf($sql, $order->TableName, $this->Conn->qstr($gateway_object->getGWResponce()), $order->IDField, $order->GetID() );
$this->Conn->Query($sql);
$order->SetDBField('GWResult1', $gateway_object->getGWResponce() );
return array('result'=>$payment_result, 'data'=>$gateway_object->parsed_responce, 'gw_data' => $gw_data, 'error_msg'=>$gateway_object->getErrorMsg());
}
/**
* Returns parameters, used to send order-related e-mails
*
* @param OrdersItem $order
* @return array
*/
function OrderEmailParams(&$order)
{
$billing_email = $order->GetDBField('BillingEmail');
$sql = 'SELECT Email
FROM ' . $this->Application->getUnitConfig('u')->getTableName() . '
WHERE PortalUserId = ' . $order->GetDBField('PortalUserId');
$user_email = $this->Conn->GetOne($sql);
$ret = Array (
'_user_email' => $user_email, // for use when shipping vs user is required in InventoryAction
'to_name' => $order->GetDBField('BillingTo'),
'to_email' => $billing_email ? $billing_email : $user_email,
);
return $ret;
}
function PrepareCoupons($event, &$order)
{
$order_items = $this->Application->recallObject('orditems.-inv','orditems_List',Array('skip_counting'=>true,'per_page'=>-1) );
/* @var $order_items kDBList */
$order_items->linkToParent($order->Special);
$order_items->Query();
$order_items->GoFirst();
$assigned_coupons = array();
$coup_handler = $this->Application->recallObject('coup_EventHandler');
foreach($order_items->Records as $product_item)
{
if ($product_item['ItemData']) {
$item_data = unserialize($product_item['ItemData']);
if (isset($item_data['AssignedCoupon']) && $item_data['AssignedCoupon']) {
$coupon_id = $item_data['AssignedCoupon'];
// clone coupon, get new coupon ID
$coupon = $this->Application->recallObject('coup',null,array('skip_autload' => true));
/* @var $coupon kDBItem */
$coupon->Load($coupon_id);
if (!$coupon->isLoaded()) continue;
$coup_handler->SetNewCode($coupon);
$coupon->NameCopy();
$coupon->SetDBField('Name', $coupon->GetDBField('Name').' (Order #'.$order->GetField('OrderNumber').')');
$coupon->Create();
// add coupon code to array
array_push($assigned_coupons, $coupon->GetDBField('Code'));
}
}
}
/* @var $order OrdersItem */
if ($assigned_coupons) {
$comments = $order->GetDBField('AdminComment');
if ($comments) $comments .= "\r\n";
$comments .= "Issued coupon(s): ". join(',', $assigned_coupons);
$order->SetDBField('AdminComment', $comments);
$order->Update();
}
if ($assigned_coupons) $this->Application->SetVar('order_coupons', join(',', $assigned_coupons));
}
/**
* Completes order if possible
*
* @param kEvent $event
* @return bool
*/
function OnCompleteOrder($event)
{
$this->LockTables($event);
- if ( !$this->CheckQuantites($event) ) {
+ $reoccurring_order = substr($event->Special, 0, 9) == 'recurring';
+
+ if ( !$reoccurring_order && !$this->CheckQuantites($event) ) {
+ // don't check quantities (that causes recalculate) for reoccurring orders
return;
}
$this->ReserveItems($event);
$order = $event->getObject();
/* @var $order OrdersItem */
$charge_result = $this->ChargeOrder($order);
if (!$charge_result['result']) {
$this->FreeItems($event);
$this->Application->StoreVar('gw_error', $charge_result['error_msg']);
//$this->Application->StoreVar('gw_error', getArrayValue($charge_result, 'data', 'responce_reason_text') );
$event->redirect = $this->Application->GetVar('failure_template');
$event->SetRedirectParam('m_cat_id', 0);
if ($event->Special == 'recurring') { // if we set failed status for other than recurring special the redirect will not occur
$event->status = kEvent::erFAIL;
}
return false;
}
// call CompleteOrder events for items in order BEFORE SplitOrder (because ApproveEvents are called there)
$order_items = $this->Application->recallObject('orditems.-inv','orditems_List',Array('skip_counting'=>true,'per_page'=>-1) );
/* @var $order_items kDBList */
$order_items->linkToParent($order->Special);
$order_items->Query(true);
$order_items->GoFirst();
foreach($order_items->Records as $product_item)
{
if (!$product_item['ProductId']) continue; // product may have been deleted
$this->raiseProductEvent('CompleteOrder', $product_item['ProductId'], $product_item);
}
$shipping_control = getArrayValue($charge_result, 'gw_data', 'gw_params', 'shipping_control');
if ($event->Special != 'recurring') {
if ($shipping_control && $shipping_control != SHIPPING_CONTROL_PREAUTH ) {
// we have to do it here, because the coupons are used in the e-mails
$this->PrepareCoupons($event, $order);
}
$this->Application->emailUser('ORDER.SUBMIT', null, $this->OrderEmailParams($order));
$this->Application->emailAdmin('ORDER.SUBMIT');
}
if ($shipping_control === false || $shipping_control == SHIPPING_CONTROL_PREAUTH ) {
$order->SetDBField('Status', ORDER_STATUS_PENDING);
$order->Update();
}
else {
$this->SplitOrder($event, $order);
}
if (!$this->Application->isAdminUser) {
// for tracking code
$this->Application->StoreVar('last_order_amount', $order->GetDBField('TotalAmount'));
$this->Application->StoreVar('last_order_number', $order->GetDBField('OrderNumber'));
$this->Application->StoreVar('last_order_customer', $order->GetDBField('BillingTo'));
$this->Application->StoreVar('last_order_user', $order->GetDBField('Username'));
$event->redirect = $this->Application->GetVar('success_template');
$event->SetRedirectParam('m_cat_id', 0);
}
else
{
// $event->CallSubEvent('OnSave');
}
$order_id = $order->GetID();
$config = $event->getUnitConfig();
$original_amount = $order->GetDBField('SubTotal') + $order->GetDBField('ShippingCost') + $order->GetDBField('VAT') + $order->GetDBField('ProcessingFee') + $order->GetDBField('InsuranceFee') - $order->GetDBField('GiftCertificateDiscount');
$sql = 'UPDATE '. $config->getTableName() .'
SET OriginalAmount = '.$original_amount.'
WHERE '. $config->getIDField() .' = '.$order_id;
$this->Conn->Query($sql);
$this->Application->StoreVar('front_order_id', $order_id);
$this->Application->RemoveVar('ord_id');
$this->Application->Session->SetCookie('shop_cart_cookie', '', strtotime('-1 month'));
}
/**
* Set billing address same as shipping
*
* @param kEvent $event
*/
function setBillingAddress($event)
{
$object = $event->getObject();
/* @var $object OrdersItem */
if ( $object->HasTangibleItems() ) {
if ( $this->Application->GetVar('same_address') ) {
// copy shipping address to billing
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
list($id, $field_values) = each($items_info);
$address_fields = Array (
'To', 'Company', 'Phone', 'Fax', 'Email',
'Address1', 'Address2', 'City', 'State',
'Zip', 'Country'
);
foreach ($address_fields as $address_field) {
$items_info[$id]['Billing' . $address_field] = $object->GetDBField('Shipping' . $address_field);
}
$this->Application->SetVar($event->getPrefixSpecial(true), $items_info);
}
}
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnProceedToPreview($event)
{
$this->setBillingAddress($event);
$event->CallSubEvent('OnUpdate');
$event->redirect = $this->Application->GetVar('preview_template');
}
function OnViewCart($event)
{
$this->StoreContinueShoppingLink();
$event->redirect = $this->Application->GetVar('viewcart_template');
}
function OnContinueShopping($event)
{
$order_helper = $this->Application->recallObject('OrderHelper');
/* @var $order_helper OrderHelper */
$template = $this->Application->GetVar('continue_shopping_template');
$event->redirect = $order_helper->getContinueShoppingTemplate($template);
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnCheckout($event)
{
$this->OnUpdateCart($event);
if ( !$event->getEventParam('RecalculateChangedCart') ) {
$object = $event->getObject();
/* @var $object OrdersItem */
if ( !$object->HasTangibleItems() ) {
$object->SetDBField('ShippingTo', '');
$object->SetDBField('ShippingCompany', '');
$object->SetDBField('ShippingPhone', '');
$object->SetDBField('ShippingFax', '');
$object->SetDBField('ShippingEmail', '');
$object->SetDBField('ShippingAddress1', '');
$object->SetDBField('ShippingAddress2', '');
$object->SetDBField('ShippingCity', '');
$object->SetDBField('ShippingState', '');
$object->SetDBField('ShippingZip', '');
$object->SetDBField('ShippingCountry', '');
$object->SetDBField('ShippingType', 0);
$object->SetDBField('ShippingCost', 0);
$object->SetDBField('ShippingCustomerAccount', '');
$object->SetDBField('ShippingTracking', '');
$object->SetDBField('ShippingDate', 0);
$object->SetDBField('ShippingOption', 0);
$object->SetDBField('ShippingInfo', '');
$object->Update();
}
$event->redirect = $this->Application->GetVar('next_step_template');
$order_id = $this->Application->GetVar('order_id');
if ( $order_id !== false ) {
$event->SetRedirectParam('ord_id', $order_id);
}
}
}
/**
* Restores order from cookie
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnRestoreOrder(kEvent $event)
{
if ( $this->Application->isAdmin || $this->Application->RecallVar('ord_id') ) {
// admin OR there is an active order -> don't restore from cookie
return;
}
$shop_cart_cookie = $this->Application->GetVarDirect('shop_cart_cookie', 'Cookie');
if ( !$shop_cart_cookie ) {
return;
}
$user_id = $this->Application->RecallVar('user_id');
$sql = 'SELECT OrderId
FROM ' . TABLE_PREFIX . 'Orders
WHERE (OrderId = ' . (int)$shop_cart_cookie . ') AND (Status = ' . ORDER_STATUS_INCOMPLETE . ') AND (PortalUserId = ' . $user_id . ')';
$order_id = $this->Conn->GetOne($sql);
if ( $order_id ) {
$this->Application->StoreVar('ord_id', $order_id);
}
}
/**
* Redirect user to Billing checkout step
*
* @param kEvent $event
*/
function OnProceedToBilling($event)
{
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( $items_info ) {
list($id, $field_values) = each($items_info);
$object = $event->getObject();
/* @var $object kDBItem */
$payment_type_id = $object->GetDBField('PaymentType');
if ( !$payment_type_id ) {
$default_type = $this->_getDefaultPaymentType();
if ( $default_type ) {
$field_values['PaymentType'] = $default_type;
$items_info[$id] = $field_values;
$this->Application->SetVar($event->getPrefixSpecial(true), $items_info);
}
}
}
$event->CallSubEvent('OnUpdate');
$event->redirect = $this->Application->GetVar('next_step_template');
}
/**
* Removes reoccurring mark from the order
*
* @param kEvent $event
* @return void
*/
protected function OnCancelRecurring($event)
{
$order = $event->getObject();
/* @var $order OrdersItem */
$order->SetDBField('IsRecurringBilling', 0);
$order->Update();
if ( $this->Application->GetVar('cancelrecurring_ok_template') ) {
$event->redirect = $this->Application->GetVar('cancelrecurring_ok_template');
}
}
/**
* Occurs after updating item
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
$object = $event->getObject();
/* @var $object OrdersItem */
$cvv2 = $object->GetDBField('PaymentCVV2');
if ( $cvv2 !== false ) {
$this->Application->StoreVar('CVV2Code', $cvv2);
}
}
/**
* Updates kDBItem
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnUpdate(kEvent $event)
{
$this->setBillingAddress($event);
parent::OnUpdate($event);
if ($this->Application->isAdminUser) {
return ;
}
else {
$event->SetRedirectParam('opener', 's');
}
if ($event->status == kEvent::erSUCCESS) {
$this->createMissingAddresses($event);
}
else {
// strange: recalculate total amount on error
$object = $event->getObject();
/* @var $object OrdersItem */
$object->SetDBField('TotalAmount', $object->getTotalAmount());
}
}
/**
* Creates new address
*
* @param kEvent $event
*/
function createMissingAddresses($event)
{
if ( !$this->Application->LoggedIn() ) {
return ;
}
$object = $event->getObject();
/* @var $object kDBItem */
$addr_list = $this->Application->recallObject('addr', 'addr_List', Array ('per_page' => -1, 'skip_counting' => true));
/* @var $addr_list kDBList */
$addr_list->Query();
$address_dummy = $this->Application->recallObject('addr.-item', null, Array ('skip_autoload' => true));
/* @var $address_dummy AddressesItem */
$address_prefixes = Array ('Billing', 'Shipping');
$address_fields = Array (
'To', 'Company', 'Phone', 'Fax', 'Email', 'Address1',
'Address2', 'City', 'State', 'Zip', 'Country'
);
foreach ($address_prefixes as $address_prefix) {
$address_id = $this->Application->GetVar(strtolower($address_prefix) . '_address_id');
if ( !$this->Application->GetVar('check_' . strtolower($address_prefix) . '_address') ) {
// form type doesn't match check type, e.g. shipping check on billing form
continue;
}
if ( $address_id > 0 ) {
$address_dummy->Load($address_id);
}
else {
$address_dummy->SetDBField('PortalUserId', $this->Application->RecallVar('user_id'));
}
foreach ($address_fields as $address_field) {
$address_dummy->SetDBField($address_field, $object->GetDBField($address_prefix . $address_field));
}
$address_dummy->MarkAddress($address_prefix, false);
$ret = ($address_id > 0) ? $address_dummy->Update() : $address_dummy->Create();
}
}
/**
* Updates shopping cart content
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnUpdateCart($event)
{
$this->Application->HandleEvent(new kEvent('orditems:OnUpdate'));
$event->CallSubEvent('OnRecalculateItems');
}
/**
* Updates cart and returns various info in JSON format
*
* @param kEvent $event
*/
function OnUpdateCartJSON($event)
{
if ( $this->Application->GetVar('ajax') != 'yes' ) {
return;
}
$object = $event->getObject();
/* @var $object kDBItem */
// 1. delete given order item by id
$delete_id = $this->Application->GetVar('delete_id');
if ( $delete_id !== false ) {
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'OrderItems
WHERE OrderId = ' . $object->GetID() . ' AND OrderItemId = ' . (int)$delete_id;
$this->Conn->Query($sql);
}
// 2. remove coupon
$remove = $this->Application->GetVar('remove');
if ( $remove == 'coupon' ) {
$this->RemoveCoupon($object);
$object->setCheckoutError(OrderCheckoutErrorType::COUPON, OrderCheckoutError::COUPON_REMOVED);
}
elseif ( $remove == 'gift_certificate' ) {
$this->RemoveGiftCertificate($object);
$object->setCheckoutError(OrderCheckoutErrorType::GIFT_CERTIFICATE, OrderCheckoutError::GC_REMOVED);
}
// 3. update product quantities and recalculate all discounts
$this->Application->HandleEvent(new kEvent('orditems:OnUpdate'));
$event->CallSubEvent('OnRecalculateItems');
// 4. remove "orditems" object of kDBItem class, since getOrderInfo uses kDBList object under same prefix
$this->Application->removeObject('orditems');
$order_helper = $this->Application->recallObject('OrderHelper');
/* @var $order_helper OrderHelper */
$event->status = kEvent::erSTOP;
$currency = $this->Application->GetVar('currency', 'selected');
echo json_encode( $order_helper->getOrderInfo($object, $currency) );
}
/**
* Adds item to cart
*
* @param kEvent $event
*/
function OnAddToCart($event)
{
$this->StoreContinueShoppingLink();
$qty = $this->Application->GetVar('qty');
$options = $this->Application->GetVar('options');
// multiple or options add
$items = Array();
if (is_array($qty)) {
foreach ($qty as $item_id => $combinations)
{
if (is_array($combinations)) {
foreach ($combinations as $comb_id => $comb_qty) {
if ($comb_qty == 0) continue;
$items[] = array('item_id' => $item_id, 'qty' => $comb_qty, 'comb' => $comb_id);
}
}
else {
$items[] = array('item_id' => $item_id, 'qty' => $combinations);
}
}
}
if (!$items) {
if (!$qty || is_array($qty)) $qty = 1;
$item_id = $this->Application->GetVar('p_id');
if (!$item_id) return ;
$items = array(array('item_id' => $item_id, 'qty' => $qty));
}
// remember item data passed to event when called
$default_item_data = $event->getEventParam('ItemData');
$default_item_data = $default_item_data ? unserialize($default_item_data) : Array();
foreach ($items as $an_item) {
$item_id = $an_item['item_id'];
$qty = $an_item['qty'];
$comb = getArrayValue($an_item, 'comb');
$item_data = $default_item_data;
$product = $this->Application->recallObject('p', null, Array('skip_autoload' => true));
/* @var $product ProductsItem */
$product->Load($item_id);
$event->setEventParam('ItemData', null);
if ($product->GetDBField('AssignedCoupon')) {
$item_data['AssignedCoupon'] = $product->GetDBField('AssignedCoupon');
}
// 1. store options information OR
if ($comb) {
$combination = $this->Conn->GetOne('SELECT Combination FROM '.TABLE_PREFIX.'ProductOptionCombinations WHERE CombinationId = '.$comb);
$item_data['Options'] = unserialize($combination);
}
elseif (is_array($options)) {
$item_data['Options'] = $options[$item_id];
}
// 2. store subscription information OR
if( $product->GetDBField('Type') == 2 ) // subscriptions
{
$item_data = $this->BuildSubscriptionItemData($item_id, $item_data);
}
// 3. store package information
if( $product->GetDBField('Type') == 5 ) // package
{
$package_content_ids = $product->GetPackageContentIds();
$product_package_item = $this->Application->recallObject('p.-packageitem');
/* @var $product_package_item ProductsItem */
$package_item_data = array();
foreach ($package_content_ids as $package_item_id){
$product_package_item->Load($package_item_id);
$package_item_data[$package_item_id] = array();
if( $product_package_item->GetDBField('Type') == 2 ) // subscriptions
{
$package_item_data[$package_item_id] = $this->BuildSubscriptionItemData($package_item_id, $item_data);
}
}
$item_data['PackageContent'] = $product->GetPackageContentIds();
$item_data['PackageItemsItemData'] = $package_item_data;
}
$event->setEventParam('ItemData', serialize($item_data));
// 1 for PacakgeNum when in admin - temporary solution to overcome splitting into separate sub-orders
// of orders with items added through admin when approving them
$this->AddItemToOrder($event, $item_id, $qty, $this->Application->isAdminUser ? 1 : null);
}
if ($event->status == kEvent::erSUCCESS && !$event->redirect) {
$event->SetRedirectParam('pass', 'm');
$event->SetRedirectParam('pass_category', 0); //otherwise mod-rewrite shop-cart URL will include category
$event->redirect = true;
}
else {
if ($this->Application->isAdminUser) {
$event->SetRedirectParam('opener', 'u');
}
}
}
/**
* Returns table prefix from event (temp or live)
*
* @param kEvent $event
* @return string
* @todo Needed? Should be refactored (by Alex)
*/
function TablePrefix(kEvent $event)
{
return $this->UseTempTables($event) ? $this->Application->GetTempTablePrefix('prefix:' . $event->Prefix) . TABLE_PREFIX : TABLE_PREFIX;
}
/**
* Check if required options are selected & selected option combination is in stock
*
* @param kEvent $event
* @param Array $options
* @param int $product_id
* @param int $qty
* @param int $selection_mode
* @return bool
*/
function CheckOptions($event, &$options, $product_id, $qty, $selection_mode)
{
// 1. check for required options
$selection_filter = $selection_mode == 1 ? ' AND OptionType IN (1,3,6) ' : '';
$req_options = $this->Conn->GetCol('SELECT ProductOptionId FROM '.TABLE_PREFIX.'ProductOptions WHERE ProductId = '.$product_id.' AND Required = 1 '.$selection_filter);
$result = true;
foreach ($req_options as $opt_id) {
if (!getArrayValue($options, $opt_id)) {
$this->Application->SetVar('opt_error', 1); //let the template know we have an error
$result = false;
}
}
// 2. check for option combinations in stock
$comb_salt = $this->OptionsSalt($options, true);
if ($comb_salt) {
$poc_config = $this->Application->getUnitConfig('poc');
// such option combination is defined explicitly
$poc_table = $poc_config->getTableName();
$sql = 'SELECT Availability
FROM '.$poc_table.'
WHERE CombinationCRC = '.$comb_salt;
$comb_availble = $this->Conn->GetOne($sql);
// 2.1. check if Availability flag is set, then
if ($comb_availble == 1) {
// 2.2. check for quantity in stock
$table = Array();
$table['poc'] = $poc_config->getTableName();
$table['p'] = $this->Application->getUnitConfig('p')->getTableName();
$table['oi'] = $this->TablePrefix($event).'OrderItems';
$object = $event->getObject();
$ord_id = $object->GetID();
// 2.3. check if some amount of same combination & product are not already in shopping cart
$sql = 'SELECT '.
$table['p'].'.InventoryStatus,'.
$table['p'].'.BackOrder,
IF('.$table['p'].'.InventoryStatus = 2, '.$table['poc'].'.QtyInStock, '.$table['p'].'.QtyInStock) AS QtyInStock,
IF('.$table['oi'].'.OrderItemId IS NULL, 0, '.$table['oi'].'.Quantity) AS Quantity
FROM '.$table['p'].'
LEFT JOIN '.$table['poc'].' ON
'.$table['p'].'.ProductId = '.$table['poc'].'.ProductId
LEFT JOIN '.$table['oi'].' ON
('.$table['oi'].'.OrderId = '.$ord_id.') AND
('.$table['oi'].'.OptionsSalt = '.$comb_salt.') AND
('.$table['oi'].'.ProductId = '.$product_id.') AND
('.$table['oi'].'.BackOrderFlag = 0)
WHERE '.$table['poc'].'.CombinationCRC = '.$comb_salt;
$product_info = $this->Conn->GetRow($sql);
if ($product_info['InventoryStatus']) {
$backordering = $this->Application->ConfigValue('Comm_Enable_Backordering');
if (!$backordering || $product_info['BackOrder'] == 0) {
// backordering is not enabled generally or for this product directly, then check quantities in stock
if ($qty + $product_info['Quantity'] > $product_info['QtyInStock']) {
$this->Application->SetVar('opt_error', 2);
$result = false;
}
}
}
}
elseif ($comb_availble !== false) {
$this->Application->SetVar('opt_error', 2);
$result = false;
}
}
if ($result) {
$event->status = kEvent::erSUCCESS;
$shop_cart_template = $this->Application->GetVar('shop_cart_template');
$event->redirect = $this->Application->isAdminUser || !$shop_cart_template ? true : $shop_cart_template;
}
else {
$event->status = kEvent::erFAIL;
}
return $result;
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnUpdateItemOptions($event)
{
$opt_data = $this->Application->GetVar('options');
$options = getArrayValue($opt_data, $this->Application->GetVar('p_id'));
if (!$options) {
$qty_data = $this->Application->GetVar('qty');
$comb_id = key(getArrayValue($qty_data, $this->Application->GetVar('p_id')));
$options = unserialize($this->Conn->GetOne('SELECT Combination FROM '.TABLE_PREFIX.'ProductOptionCombinations WHERE CombinationId = '.$comb_id));
}
if (!$options) return;
$ord_item = $this->Application->recallObject('orditems.-opt', null, Array ('skip_autoload' => true));
/* @var $ord_item kDBItem */
$ord_item->Load($this->Application->GetVar('orditems_id'));
// assuming that quantity cannot be changed during order item editing
if (!$this->CheckOptions($event, $options, $ord_item->GetDBField('ProductId'), 0, $ord_item->GetDBField('OptionsSelectionMode'))) return;
$item_data = unserialize($ord_item->GetDBField('ItemData'));
$item_data['Options'] = $options;
$ord_item->SetDBField('ItemData', serialize($item_data));
$ord_item->SetDBField('OptionsSalt', $this->OptionsSalt($options));
$ord_item->Update();
$event->CallSubEvent('OnRecalculateItems');
if ($event->status == kEvent::erSUCCESS && $this->Application->isAdminUser) {
$event->SetRedirectParam('opener', 'u');
}
}
function BuildSubscriptionItemData($item_id, $item_data)
{
$products_config = $this->Application->getUnitConfig('p');
$sql = 'SELECT AccessGroupId
FROM ' . $products_config->getTableName() . '
WHERE ' . $products_config->getIDField() . ' = ' . $item_id;
$item_data['PortalGroupId'] = $this->Conn->GetOne($sql);
/* TODO check on implementation
$sql = 'SELECT AccessDuration, AccessUnit, DurationType, AccessExpiration
FROM %s
WHERE %s = %s';
*/
$pricing_config = $this->Application->getUnitConfig('pr');
$pricing_id = $this->GetPricingId($item_id, $item_data);
$sql = 'SELECT *
FROM ' . $pricing_config->getTableName() . '
WHERE ' . $pricing_config->getIDField() . ' = ' . $pricing_id;
$pricing_info = $this->Conn->GetRow($sql);
$item_data['PricingId'] = $pricing_id;
$unit_secs = Array(1 => 1, 2 => 60, 3 => 3600, 4 => 86400, 5 => 604800, 6 => 2592000, 7 => 31536000);
/* TODO check on implementation (code from customization healtheconomics.org)
$item_data['DurationType'] = $pricing_info['DurationType'];
$item_data['AccessExpiration'] = $pricing_info['AccessExpiration'];
*/
$item_data['Duration'] = $pricing_info['AccessDuration'] * $unit_secs[ $pricing_info['AccessUnit'] ];
return $item_data;
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnApplyCoupon($event)
{
$code = $this->Application->GetVar('coupon_code');
if ($code == '') {
return ;
}
$object = $event->getObject();
/* @var $object OrdersItem */
$coupon = $this->Application->recallObject('coup', null, Array ('skip_autoload' => true));
/* @var $coupon kDBItem */
$coupon->Load($code, 'Code');
if ( !$coupon->isLoaded() ) {
$event->status = kEvent::erFAIL;
$object->setCheckoutError(OrderCheckoutErrorType::COUPON, OrderCheckoutError::COUPON_CODE_INVALID);
$event->redirect = false; // check!!!
return ;
}
$expire_date = $coupon->GetDBField('Expiration');
$number_of_use = $coupon->GetDBField('NumberOfUses');
if ( $coupon->GetDBField('Status') != 1 || ($expire_date && $expire_date < adodb_mktime()) ||
(isset($number_of_use) && $number_of_use <= 0))
{
$event->status = kEvent::erFAIL;
$object->setCheckoutError(OrderCheckoutErrorType::COUPON, OrderCheckoutError::COUPON_CODE_EXPIRED);
$event->redirect = false;
return ;
}
$last_used = adodb_mktime();
$coupon->SetDBField('LastUsedBy', $this->Application->RecallVar('user_id'));
$coupon->SetDBField('LastUsedOn_date', $last_used);
$coupon->SetDBField('LastUsedOn_time', $last_used);
if ( isset($number_of_use) ) {
$coupon->SetDBField('NumberOfUses', $number_of_use - 1);
if ($number_of_use == 1) {
$coupon->SetDBField('Status', 2);
}
}
$coupon->Update();
$this->Application->getUnitConfig('ord')->setAutoLoad(true);
$order = $this->Application->recallObject('ord');
/* @var $order OrdersItem */
$order->SetDBField('CouponId', $coupon->GetDBField('CouponId'));
$order->SetDBField('CouponName', $coupon->GetDBField('Name')); // calculated field
$order->Update();
$object->setCheckoutError(OrderCheckoutErrorType::COUPON, OrderCheckoutError::COUPON_APPLIED);
// OnApplyCoupon is called as hook for OnUpdateCart/OnCheckout, which calls OnRecalcualate themself
}
/**
* Removes coupon from order
*
* @param kEvent $event
* @deprecated
*/
function OnRemoveCoupon($event)
{
$object = $event->getObject();
/* @var $object OrdersItem */
$this->RemoveCoupon($object);
$object->setCheckoutError(OrderCheckoutErrorType::COUPON, OrderCheckoutError::COUPON_REMOVED);
$event->CallSubEvent('OnRecalculateItems');
}
/**
* Removes coupon from a given order
*
* @param OrdersItem $object
*/
function RemoveCoupon(&$object)
{
$coupon = $this->Application->recallObject('coup', null, Array('skip_autoload' => true));
/* @var $coupon kDBItem */
$coupon->Load( $object->GetDBField('CouponId') );
if ( $coupon->isLoaded() ) {
$coupon->SetDBField('NumberOfUses', $coupon->GetDBField('NumberOfUses') + 1);
$coupon->SetDBField('Status', STATUS_ACTIVE);
$coupon->Update();
}
$object->SetDBField('CouponId', 0);
$object->SetDBField('CouponName', ''); // calculated field
$object->SetDBField('CouponDiscount', 0);
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnAddVirtualProductToCart($event)
{
$l_info = $this->Application->GetVar('l');
if($l_info)
{
foreach($l_info as $link_id => $link_info) {}
$item_data['LinkId'] = $link_id;
$item_data['ListingTypeId'] = $link_info['ListingTypeId'];
}
else
{
$link_id = $this->Application->GetVar('l_id');
$sql = 'SELECT ResourceId FROM '.$this->Application->getUnitConfig('l')->getTableName().'
WHERE LinkId = '.$link_id;
$sql = 'SELECT ListingTypeId FROM '.$this->Application->getUnitConfig('ls')->getTableName().'
WHERE ItemResourceId = '.$this->Conn->GetOne($sql);
$item_data['LinkId'] = $link_id;
$item_data['ListingTypeId'] = $this->Conn->GetOne($sql);
}
$sql = 'SELECT VirtualProductId FROM '.$this->Application->getUnitConfig('lst')->getTableName().'
WHERE ListingTypeId = '.$item_data['ListingTypeId'];
$item_id = $this->Conn->GetOne($sql);
$event->setEventParam('ItemData', serialize($item_data));
$this->AddItemToOrder($event, $item_id);
$shop_cart_template = $this->Application->GetVar('shop_cart_template');
if ( $shop_cart_template ) {
$event->redirect = $shop_cart_template;
}
// don't pass unused info to shopping cart, brokes old mod-rewrites
$event->SetRedirectParam('pass', 'm'); // not to pass link id
$event->SetRedirectParam('m_cat_id', 0); // not to pass link id
}
function OnRemoveFromCart($event)
{
$ord_item_id = $this->Application->GetVar('orditems_id');
$ord_id = $this->getPassedID($event);
$this->Conn->Query('DELETE FROM '.TABLE_PREFIX.'OrderItems WHERE OrderId = '.$ord_id.' AND OrderItemId = '.$ord_item_id);
$this->OnRecalculateItems($event);
}
function OnCleanupCart($event)
{
$object = $event->getObject();
$sql = 'DELETE FROM '.TABLE_PREFIX.'OrderItems
WHERE OrderId = '.$this->getPassedID($event);
$this->Conn->Query($sql);
$this->RemoveCoupon($object);
$this->RemoveGiftCertificate($object);
$this->OnRecalculateItems($event);
}
/**
* Returns order id from session or last used
*
* @param kEvent $event
* @return int
* @access public
*/
public function getPassedID(kEvent $event)
{
$event->setEventParam('raise_warnings', 0);
$passed = parent::getPassedID($event);
if ( $this->Application->isAdminUser ) {
// work as usual in admin
return $passed;
}
if ( $event->Special == 'last' ) {
// return last order id (for using on thank you page)
$order_id = $this->Application->RecallVar('front_order_id');
return $order_id > 0 ? $order_id : FAKE_ORDER_ID; // FAKE_ORDER_ID helps to keep parent filter for order items set in "kDBList::linkToParent"
}
$ses_id = $this->Application->RecallVar($event->getPrefixSpecial(true) . '_id');
if ( $passed && ($passed != $ses_id) ) {
// order id given in url doesn't match our current order id
$sql = 'SELECT PortalUserId
FROM ' . TABLE_PREFIX . 'Orders
WHERE OrderId = ' . $passed;
$user_id = $this->Conn->GetOne($sql);
if ( $user_id == $this->Application->RecallVar('user_id') ) {
// current user is owner of order with given id -> allow him to view order details
return $passed;
}
else {
// current user is not owner of given order -> hacking attempt
$this->Application->SetVar($event->getPrefixSpecial() . '_id', 0);
return 0;
}
}
// not passed or equals to ses_id
return $ses_id > 0 ? $ses_id : FAKE_ORDER_ID; // FAKE_ORDER_ID helps to keep parent filter for order items set in "kDBList::linkToParent"
}
/**
* Load item if id is available
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function LoadItem(kEvent $event)
{
$id = $this->getPassedID($event);
if ( $id == FAKE_ORDER_ID ) {
// if we already know, that there is no such order,
// then don't run database query, that will confirm that
$object = $event->getObject();
/* @var $object kDBItem */
$object->Clear($id);
return;
}
parent::LoadItem($event);
}
/**
* Creates new shopping cart
*
* @param kEvent $event
*/
function _createNewCart($event)
{
$object = $event->getObject( Array('skip_autoload' => true) );
/* @var $object kDBItem */
$this->setNextOrderNumber($event);
$object->SetDBField('Status', ORDER_STATUS_INCOMPLETE);
$object->SetDBField('VisitId', $this->Application->RecallVar('visit_id') );
// get user
if ( $this->Application->LoggedIn() ) {
$user = $this->Application->recallObject('u.current');
/* @var $user UsersItem */
$user_id = $user->GetID();
$object->SetDBField('BillingEmail', $user->GetDBField('Email'));
}
else {
$user_id = USER_GUEST;
}
$object->SetDBField('PortalUserId', $user_id);
// get affiliate
$affiliate_id = $this->isAffiliate($user_id);
if ( $affiliate_id ) {
$object->SetDBField('AffiliateId', $affiliate_id);
}
else {
$affiliate_storage_method = $this->Application->ConfigValue('Comm_AffiliateStorageMethod');
if ( $affiliate_storage_method == 1 ) {
$object->SetDBField('AffiliateId', (int)$this->Application->RecallVar('affiliate_id'));
}
else {
$object->SetDBField('AffiliateId', (int)$this->Application->GetVar('affiliate_id'));
}
}
// get payment type
$default_type = $this->_getDefaultPaymentType();
if ( $default_type ) {
$object->SetDBField('PaymentType', $default_type);
}
// vat setting
$object->SetDBField('VATIncluded', $this->Application->ConfigValue('OrderVATIncluded'));
$created = $object->Create();
if ( $created ) {
$id = $object->GetID();
$this->Application->SetVar($event->getPrefixSpecial(true) . '_id', $id);
$this->Application->StoreVar($event->getPrefixSpecial(true) . '_id', $id);
$this->Application->Session->SetCookie('shop_cart_cookie', $id, strtotime('+1 month'));
return $id;
}
return 0;
}
/**
* Returns default payment type for order
*
* @return int
*/
function _getDefaultPaymentType()
{
$default_type = $this->Application->siteDomainField('PrimaryPaymentTypeId');
if (!$default_type) {
$sql = 'SELECT PaymentTypeId
FROM ' . TABLE_PREFIX . 'PaymentTypes
WHERE IsPrimary = 1';
$default_type = $this->Conn->GetOne($sql);
}
return $default_type;
}
function StoreContinueShoppingLink()
{
$this->Application->StoreVar('continue_shopping', 'external:'.PROTOCOL.SERVER_NAME.$this->Application->RecallVar('last_url'));
}
/**
* Sets required fields for order, based on current checkout step
* !!! Do not use switch here, since all cases may be on the same form simultaneously
*
* @param kEvent $event
*/
function SetStepRequiredFields($event)
{
$order = $event->getObject();
/* @var $order OrdersItem */
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ($items_info) {
// updated address available from SUBMIT -> use it
list($id, $field_values) = each($items_info);
}
else {
// no updated address -> use current address
$field_values = Array (
'ShippingCountry' => $order->GetDBField('ShippingCountry'),
'BillingCountry' => $order->GetDBField('BillingCountry'),
'PaymentType' => $order->GetDBField('PaymentType'),
);
}
// shipping address required fields
if ($this->Application->GetVar('check_shipping_address')) {
$has_tangibles = $order->HasTangibleItems();
$req_fields = array('ShippingTo', 'ShippingAddress1', 'ShippingCity', 'ShippingZip', 'ShippingCountry', /*'ShippingPhone',*/ 'BillingEmail');
$order->setRequired($req_fields, $has_tangibles);
$order->setRequired('ShippingState', $cs_helper->CountryHasStates( $field_values['ShippingCountry'] ));
}
// billing address required fields
if ($this->Application->GetVar('check_billing_address')) {
$req_fields = array('BillingTo', 'BillingAddress1', 'BillingCity', 'BillingZip', 'BillingCountry', 'BillingPhone', 'BillingEmail');
$order->setRequired($req_fields);
$order->setRequired('BillingState', $cs_helper->CountryHasStates( $field_values['BillingCountry'] ));
}
$check_cc = $this->Application->GetVar('check_credit_card');
if ( $check_cc && ($field_values['PaymentType'] == $order->GetDBField('PaymentType')) ) {
// cc check required AND payment type was not changed during SUBMIT
if ( $this->Application->isAdminUser ) {
$req_fields = Array (/*'PaymentCardType',*/ 'PaymentAccount', /*'PaymentNameOnCard',*/ 'PaymentCCExpDate');
}
else {
$req_fields = Array (/*'PaymentCardType',*/ 'PaymentAccount', /*'PaymentNameOnCard',*/ 'PaymentCCExpDate', 'PaymentCVV2');
}
$order->setRequired($req_fields);
}
}
/**
* Set's order's user_id to user from session or Guest otherwise
*
* @param kEvent $event
*/
function CheckUser($event)
{
if ($this->Application->isAdminUser || defined('GW_NOTIFY')) {
// don't check for user in order while processing payment
// gateways, because they can do cross-domain ssl redirects
return;
}
$order = $event->getObject();
/* @var $order OrdersItem */
$ses_user = $this->Application->RecallVar('user_id');
if ( $order->GetDBField('PortalUserId') != $ses_user ) {
if ( $ses_user == 0 ) {
$ses_user = USER_GUEST;
}
$order->SetDBField('PortalUserId', $ses_user);
// since CheckUser is called in OnBeforeItemUpdate, we don't need to call udpate here, just set the field
}
}
/* ======================== ADMIN ONLY ======================== */
/**
* Prepare temp tables for creating new item
* but does not create it. Actual create is
* done in OnPreSaveCreated
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnPreCreate(kEvent $event)
{
parent::OnPreCreate($event);
$object = $event->getObject();
/* @var $object kDBItem */
$this->setNextOrderNumber($event);
$object->SetDBField('OrderIP', $this->Application->getClientIp());
$order_type = $this->getTypeBySpecial( $this->Application->GetVar('order_type') );
$object->SetDBField('Status', $order_type);
}
/**
* When cloning orders set new order number to them
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeClone(kEvent $event)
{
parent::OnBeforeClone($event);
$object = $event->getObject();
/* @var $object OrdersItem */
if ( substr($event->Special, 0, 9) == 'recurring' ) {
$object->SetDBField('SubNumber', $object->getNextSubNumber());
$object->SetDBField('OriginalAmount', 0); // needed in this case ?
}
else {
$this->setNextOrderNumber($event);
$object->SetDBField('OriginalAmount', 0);
}
$object->SetDBField('OrderDate', adodb_mktime());
$object->UpdateFormattersSubFields();
$object->SetDBField('GWResult1', '');
$object->SetDBField('GWResult2', '');
}
function OnReserveItems($event)
{
$order_items = $this->Application->recallObject('orditems.-inv','orditems_List',Array('skip_counting'=>true,'per_page'=>-1) );
/* @var $order_items kDBList */
$order_items->linkToParent('-inv');
// force re-query, since we are updateing through orditem ITEM, not the list, and
// OnReserveItems may be called 2 times when fullfilling backorders through product edit - first time
// from FullFillBackorders and second time from OnOrderProcess
$order_items->Query(true);
$order_items->GoFirst();
// query all combinations used in this order
$product_object = $this->Application->recallObject('p', null, Array('skip_autoload' => true));
/* @var $product_object kCatDBItem */
$product_object->SwitchToLive();
$order_item = $this->Application->recallObject('orditems.-item', null, Array('skip_autoload' => true));
/* @var $order_item kDBItem */
$combination_item = $this->Application->recallObject('poc.-item', null, Array('skip_autoload' => true));
/* @var $combination_item kDBItem */
$combinations = $this->queryCombinations($order_items);
$event->status = kEvent::erSUCCESS;
while (!$order_items->EOL()) {
$rec = $order_items->getCurrentRecord();
$product_object->Load( $rec['ProductId'] );
if (!$product_object->GetDBField('InventoryStatus')) {
$order_items->GoNext();
continue;
}
$inv_object =& $this->getInventoryObject($product_object, $combination_item, $combinations[ $rec['ProductId'].'_'.$rec['OptionsSalt'] ]);
$lack = $rec['Quantity'] - $rec['QuantityReserved'];
if ($lack > 0) {
// reserve lack or what is available (in case if we need to reserve anything, by Alex)
$to_reserve = min($lack, $inv_object->GetDBField('QtyInStock') - $product_object->GetDBField('QtyInStockMin'));
if ($to_reserve < $lack) $event->status = kEvent::erFAIL; // if we can't reserve the full lack
//reserve in order
$order_item->SetDBFieldsFromHash($rec);
$order_item->SetDBField('QuantityReserved', $rec['QuantityReserved'] + $to_reserve);
$order_item->SetId($rec['OrderItemId']);
$order_item->Update();
//update product - increase reserved, decrease in stock
$inv_object->SetDBField('QtyReserved', $inv_object->GetDBField('QtyReserved') + $to_reserve);
$inv_object->SetDBField('QtyInStock', $inv_object->GetDBField('QtyInStock') - $to_reserve);
$inv_object->SetDBField('QtyBackOrdered', $inv_object->GetDBField('QtyBackOrdered') - $to_reserve);
$inv_object->Update();
if ($product_object->GetDBField('InventoryStatus') == 2) {
// inventory by options, then restore changed combination values back to common $combinations array !!!
$combinations[ $rec['ProductId'].'_'.$rec['OptionsSalt'] ] = $inv_object->GetFieldValues();
}
}
$order_items->GoNext();
}
return true;
}
function OnOrderPrint($event)
{
$event->SetRedirectParam('opener', 's');
}
/**
* Processes order each tab info resetting to other tab info / to user info
*
* @param kEvent $event
* @access public
*/
function OnResetAddress($event)
{
$to_tab = $this->Application->GetVar('to_tab');
$from_tab = substr($event->Name, strlen('OnResetTo'));
// load values from db
$object = $event->getObject();
/* @var $object kDBItem */
// update values from submit
$field_values = $this->getSubmittedFields($event);
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
$this->DoResetAddress($object, $from_tab, $to_tab);
$object->Update();
$event->redirect = false;
}
/**
* Processes item selection from popup item selector
*
* @todo Is this called ? (by Alex)
* @param kEvent $event
*/
function OnProcessSelected($event)
{
$selected_ids = $this->Application->GetVar('selected_ids');
$product_ids = $selected_ids['p'];
if ($product_ids) {
$product_ids = explode(',', $product_ids);
// !!! LOOK OUT - Adding items to Order in admin is handled in order_ITEMS_event_handler !!!
foreach ($product_ids as $product_id) {
$this->AddItemToOrder($event, $product_id);
}
}
$event->SetRedirectParam('opener', 'u');
}
function OnMassPlaceOrder($event)
{
$object = $event->getObject( Array('skip_autoload' => true) );
$ids = $this->StoreSelectedIDs($event);
if($ids)
{
foreach($ids as $id)
{
$object->Load($id);
$this->DoPlaceOrder($event);
}
}
$event->status = kEvent::erSUCCESS;
}
/**
* Universal
* Checks if QtyInStock is enough to fullfill backorder (Qty - QtyReserved in order)
*
* @param int $ord_id
* @return bool
*/
function ReadyToProcess($ord_id)
{
$poc_table = $this->Application->getUnitConfig('poc')->getTableName();
$query = ' SELECT SUM(IF( IF('.TABLE_PREFIX.'Products.InventoryStatus = 2, '.$poc_table.'.QtyInStock, '.TABLE_PREFIX.'Products.QtyInStock) - '.TABLE_PREFIX.'Products.QtyInStockMin >= ('.TABLE_PREFIX.'OrderItems.Quantity - '.TABLE_PREFIX.'OrderItems.QuantityReserved), 0, 1))
FROM '.TABLE_PREFIX.'OrderItems
LEFT JOIN '.TABLE_PREFIX.'Products ON '.TABLE_PREFIX.'Products.ProductId = '.TABLE_PREFIX.'OrderItems.ProductId
LEFT JOIN '.$poc_table.' ON ('.$poc_table.'.CombinationCRC = '.TABLE_PREFIX.'OrderItems.OptionsSalt) AND ('.$poc_table.'.ProductId = '.TABLE_PREFIX.'OrderItems.ProductId)
WHERE OrderId = '.$ord_id.'
GROUP BY OrderId';
// IF (IF(InventoryStatus = 2, poc.QtyInStock, p.QtyInStock) - QtyInStockMin >= (Quantity - QuantityReserved), 0, 1
return ($this->Conn->GetOne($query) == 0);
}
/**
* Return all option combinations used in order
*
* @param kDBList $order_items
* @return Array
*/
function queryCombinations(&$order_items)
{
// 1. collect combination crc used in order
$combinations = Array();
while (!$order_items->EOL()) {
$row = $order_items->getCurrentRecord();
if ($row['OptionsSalt'] == 0) {
$order_items->GoNext();
continue;
}
$combinations[] = '(poc.ProductId = '.$row['ProductId'].') AND (poc.CombinationCRC = '.$row['OptionsSalt'].')';
$order_items->GoNext();
}
$order_items->GoFirst();
$combinations = array_unique($combinations); // if same combination+product found as backorder & normal order item
if ($combinations) {
// 2. query data about combinations
$poc_table = $this->Application->getUnitConfig('poc')->getTableName();
$sql = 'SELECT CONCAT(poc.ProductId, "_", poc.CombinationCRC) AS CombinationKey, poc.*
FROM '.$poc_table.' poc
WHERE ('.implode(') OR (', $combinations).')';
return $this->Conn->Query($sql, 'CombinationKey');
}
return Array();
}
/**
* Returns object to perform inventory actions on
*
* @param ProductsItem $product current product object in order
* @param kDBItem $combination combination dummy object
* @param Array $combination_data pre-queried combination data
* @return kDBItem
*/
function &getInventoryObject(&$product, &$combination, $combination_data)
{
if ($product->GetDBField('InventoryStatus') == 2) {
// inventory by option combinations
$combination->SetDBFieldsFromHash($combination_data);
$combination->setID($combination_data['CombinationId']);
$change_item =& $combination;
}
else {
// inventory by product ifself
$change_item =& $product;
}
return $change_item;
}
/**
* Approve order ("Pending" tab)
*
* @param kDBList $order_items
* @return int new status of order if any
*/
function approveOrder(&$order_items)
{
$product_object = $this->Application->recallObject('p', null, Array('skip_autoload' => true));
$order_item = $this->Application->recallObject('orditems.-item', null, Array('skip_autoload' => true));
$combination_item = $this->Application->recallObject('poc.-item', null, Array('skip_autoload' => true));
$combinations = $this->queryCombinations($order_items);
while (!$order_items->EOL()) {
$rec = $order_items->getCurrentRecord();
$order_item->SetDBFieldsFromHash($rec);
$order_item->SetId($rec['OrderItemId']);
$order_item->SetDBField('QuantityReserved', 0);
$order_item->Update();
$product_object->Load( $rec['ProductId'] );
if (!$product_object->GetDBField('InventoryStatus')) {
// if no inventory info is collected, then skip this order item
$order_items->GoNext();
continue;
}
$inv_object =& $this->getInventoryObject($product_object, $combination_item, $combinations[ $rec['ProductId'].'_'.$rec['OptionsSalt'] ]);
// decrease QtyReserved by amount of product used in order
$inv_object->SetDBField('QtyReserved', $inv_object->GetDBField('QtyReserved') - $rec['Quantity']);
$inv_object->Update();
if ($product_object->GetDBField('InventoryStatus') == 2) {
// inventory by options, then restore changed combination values back to common $combinations array !!!
$combinations[ $rec['ProductId'].'_'.$rec['OptionsSalt'] ] = $inv_object->GetFieldValues();
}
$order_items->GoNext();
}
return true;
}
/**
* Restores reserved items in the order
*
* @param kDBList $order_items
* @return bool
*/
function restoreOrder(&$order_items)
{
$product_object = $this->Application->recallObject('p', null, Array('skip_autoload' => true));
/* @var $product_object kCatDBItem */
$product_object->SwitchToLive();
$order_item = $this->Application->recallObject('orditems.-item', null, Array('skip_autoload' => true));
/* @var $order_item kDBItem */
$combination_item = $this->Application->recallObject('poc.-item', null, Array('skip_autoload' => true));
/* @var $combination_item kDBItem */
$combinations = $this->queryCombinations($order_items);
while( !$order_items->EOL() )
{
$rec = $order_items->getCurrentRecord();
$product_object->Load( $rec['ProductId'] );
if (!$product_object->GetDBField('InventoryStatus')) {
// if no inventory info is collected, then skip this order item
$order_items->GoNext();
continue;
}
$inv_object =& $this->getInventoryObject($product_object, $combination_item, $combinations[ $rec['ProductId'].'_'.$rec['OptionsSalt'] ]);
// cancelling backorderd qty if any
$lack = $rec['Quantity'] - $rec['QuantityReserved'];
if ($lack > 0 && $rec['BackOrderFlag'] > 0) { // lack should have been recorded as QtyBackOrdered
$inv_object->SetDBField('QtyBackOrdered', $inv_object->GetDBField('QtyBackOrdered') - $lack);
}
// canceling reservation in stock
$inv_object->SetDBField('QtyReserved', $inv_object->GetDBField('QtyReserved') - $rec['QuantityReserved']);
// putting remaining freed qty back to stock
$inv_object->SetDBField('QtyInStock', $inv_object->GetDBField('QtyInStock') + $rec['QuantityReserved']);
$inv_object->Update();
$product_h = $this->Application->recallObject('p_EventHandler');
/* @var $product_h ProductsEventHandler */
if ($product_object->GetDBField('InventoryStatus') == 2) {
// inventory by options, then restore changed combination values back to common $combinations array !!!
$combinations[ $rec['ProductId'].'_'.$rec['OptionsSalt'] ] = $inv_object->GetFieldValues();
// using freed qty to fulfill possible backorders
$product_h->FullfillBackOrders($product_object, $inv_object->GetID());
}
else {
// using freed qty to fulfill possible backorders
$product_h->FullfillBackOrders($product_object, 0);
}
$order_item->SetDBFieldsFromHash($rec);
$order_item->SetId($rec['OrderItemId']);
$order_item->SetDBField('QuantityReserved', 0);
$order_item->Update();
$order_items->GoNext();
}
return true;
}
/**
* Approve order + special processing
*
* @param kEvent $event
*/
function MassInventoryAction($event)
{
if ( $this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1) ) {
$event->status = kEvent::erFAIL;
return;
}
// process order products
$object = $this->Application->recallObject($event->Prefix . '.-inv', null, Array ('skip_autoload' => true));
/* @var $object kDBItem */
$ids = $this->StoreSelectedIDs($event);
if ( $ids ) {
foreach ($ids as $id) {
$object->Load($id);
$this->InventoryAction($event);
}
}
}
function InventoryAction($event)
{
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
$event->status = kEvent::erFAIL;
return;
}
$event_status_map = Array(
'OnMassOrderApprove' => ORDER_STATUS_TOSHIP,
'OnOrderApprove' => ORDER_STATUS_TOSHIP,
'OnMassOrderDeny' => ORDER_STATUS_DENIED,
'OnOrderDeny' => ORDER_STATUS_DENIED,
'OnMassOrderArchive' => ORDER_STATUS_ARCHIVED,
'OnOrderArchive' => ORDER_STATUS_ARCHIVED,
'OnMassOrderShip' => ORDER_STATUS_PROCESSED,
'OnOrderShip' => ORDER_STATUS_PROCESSED,
'OnMassOrderProcess' => ORDER_STATUS_TOSHIP,
'OnOrderProcess' => ORDER_STATUS_TOSHIP,
);
$order_items = $this->Application->recallObject('orditems.-inv','orditems_List',Array('skip_counting'=>true,'per_page'=>-1) );
/* @var $order_items kDBList */
$order_items->linkToParent('-inv');
$order_items->Query();
$order_items->GoFirst();
$object = $this->Application->recallObject($event->Prefix.'.-inv');
/* @var $object OrdersItem */
if ($object->GetDBField('OnHold')) {
// any actions have no effect while on hold
return ;
}
// save original order status
$original_order_status = $object->GetDBField('Status');
// preparing new status, but not setting it yet
$object->SetDBField('Status', $event_status_map[$event->Name]);
$set_new_status = false;
$event->status = kEvent::erSUCCESS;
$email_params = $this->OrderEmailParams($object);
switch ($event->Name) {
case 'OnMassOrderApprove':
case 'OnOrderApprove':
$set_new_status = false; //on successful approve order will be split and new orders will have new statuses
if ($object->GetDBField('ChargeOnNextApprove')) {
$charge_info = $this->ChargeOrder($object);
if (!$charge_info['result']) {
break;
}
// removing ChargeOnNextApprove
$object->SetDBField('ChargeOnNextApprove', 0);
$sql = 'UPDATE '.$object->TableName.' SET ChargeOnNextApprove = 0 WHERE '.$object->IDField.' = '.$object->GetID();
$this->Conn->Query($sql);
}
// charge user for order in case if we user 2step charging (e.g. AUTH_ONLY + PRIOR_AUTH_CAPTURE)
$gw_data = $object->getGatewayData();
$this->Application->registerClass( $gw_data['ClassName'], GW_CLASS_PATH.'/'.$gw_data['ClassFile'] );
$gateway_object = $this->Application->recallObject( $gw_data['ClassName'] );
/* @var $gateway_object kGWBase */
$charge_result = $gateway_object->Charge($object->GetFieldValues(), $gw_data['gw_params']);
$sql = 'UPDATE %s SET GWResult2 = %s WHERE %s = %s';
$sql = sprintf($sql, $object->TableName, $this->Conn->qstr($gateway_object->getGWResponce()), $object->IDField, $object->GetID() );
$this->Conn->Query($sql);
$object->SetDBField('GWResult2', $gateway_object->getGWResponce() );
if ($charge_result) {
$product_object = $this->Application->recallObject('p', null, Array('skip_autoload' => true));
/* @var $product_object ProductsItem */
foreach ($order_items->Records as $product_item) {
if (!$product_item['ProductId']) {
// product may have been deleted
continue;
}
$product_object->Load($product_item['ProductId']);
$hits = floor( $product_object->GetDBField('Hits') ) + 1;
$sql = 'SELECT MAX(Hits) FROM '.$this->Application->getUnitConfig('p')->getTableName().'
WHERE FLOOR(Hits) = '.$hits;
$hits = ( $res = $this->Conn->GetOne($sql) ) ? $res + 0.000001 : $hits;
$product_object->SetDBField('Hits', $hits);
$product_object->Update();
/*$sql = 'UPDATE ' . $this->Application->getUnitConfig('p')->getTableName() . '
SET Hits = Hits + ' . $product_item['Quantity'] . '
WHERE ProductId = ' . $product_item['ProductId'];
$this->Conn->Query($sql);*/
}
$this->PrepareCoupons($event, $object);
$this->SplitOrder($event, $object);
if ($object->GetDBField('IsRecurringBilling') != 1) {
$this->Application->emailUser('ORDER.APPROVE', null, $email_params);
// Mask credit card with XXXX
if ($this->Application->ConfigValue('Comm_MaskProcessedCreditCards')) {
$this->maskCreditCard($object, 'PaymentAccount');
$set_new_status = 1;
}
}
}
break;
case 'OnMassOrderDeny':
case 'OnOrderDeny':
foreach ($order_items->Records as $product_item) {
if (!$product_item['ProductId']) {
// product may have been deleted
continue;
}
$this->raiseProductEvent('Deny', $product_item['ProductId'], $product_item);
}
if ( ($original_order_status != ORDER_STATUS_INCOMPLETE ) && ($event->Name == 'OnMassOrderDeny' || $event->Name == 'OnOrderDeny') ) {
$this->Application->emailUser('ORDER.DENY', null, $email_params);
// inform payment gateway that order was declined
$gw_data = $object->getGatewayData();
if ( $gw_data ) {
$this->Application->registerClass( $gw_data['ClassName'], GW_CLASS_PATH . '/' . $gw_data['ClassFile'] );
$gateway_object = $this->Application->recallObject( $gw_data['ClassName'] );
$gateway_object->OrderDeclined($object->GetFieldValues(), $gw_data['gw_params']);
}
}
// !!! LOOK HERE !!!
// !!!! no break !!!! here on purpose!!!
case 'OnMassOrderArchive':
case 'OnOrderArchive':
// it's critical to update status BEFORE processing items because
// FullfillBackorders could be called during processing and in case
// of order denial/archive fullfill could reserve the qtys back for current backorder
$object->Update();
$this->restoreOrder($order_items);
$set_new_status = false; // already set
break;
case 'OnMassOrderShip':
case 'OnOrderShip':
$ret = Array ();
$shipping_info = $object->GetDBField('ShippingInfo');
if ($shipping_info) {
$quote_engine_collector = $this->Application->recallObject('ShippingQuoteCollector');
/* @var $quote_engine_collector ShippingQuoteCollector */
$shipping_info = unserialize($shipping_info);
$sqe_class_name = $quote_engine_collector->GetClassByType($shipping_info, 1);
}
// try to create usps order
if (($object->GetDBField('ShippingType') == 0) && ($sqe_class_name !== false)) {
$shipping_quote_engine = $this->Application->recallObject($sqe_class_name);
/* @var $shipping_quote_engine ShippingQuoteEngine */
$ret = $shipping_quote_engine->MakeOrder($object);
}
if ( !array_key_exists('error_number', $ret) ) {
$set_new_status = $this->approveOrder($order_items);
// $set_new_status = $this->shipOrder($order_items);
$object->SetDBField('ShippingDate', adodb_mktime());
$object->UpdateFormattersSubFields();
$shipping_email = $object->GetDBField('ShippingEmail');
$email_params['to_email'] = $shipping_email ? $shipping_email : $email_params['_user_email'];
$this->Application->emailUser('ORDER.SHIP', null, $email_params);
// inform payment gateway that order was shipped
$gw_data = $object->getGatewayData();
$this->Application->registerClass( $gw_data['ClassName'], GW_CLASS_PATH.'/'.$gw_data['ClassFile'] );
$gateway_object = $this->Application->recallObject( $gw_data['ClassName'] );
$gateway_object->OrderShipped($object->GetFieldValues(), $gw_data['gw_params']);
}
else {
$sqe_errors = $this->Application->RecallVar('sqe_errors');
$sqe_errors = $sqe_errors ? unserialize($sqe_errors) : Array ();
$sqe_errors[ $object->GetField('OrderNumber') ] = $ret['error_description'];
$this->Application->StoreVar('sqe_errors', serialize($sqe_errors));
}
break;
case 'OnMassOrderProcess':
case 'OnOrderProcess':
if ($this->ReadyToProcess($object->GetID())) {
$event->CallSubEvent('OnReserveItems');
if ( $event->status == kEvent::erSUCCESS ) {
$set_new_status = true;
}
$this->Application->emailUser('BACKORDER.PROCESS', null, $email_params);
}
else {
$event->status = kEvent::erFAIL;
}
break;
}
if ($set_new_status) {
$object->Update();
}
}
/**
* Hides last 4 digits from credit card number
*
* @param OrdersItem $object
* @param string $field
*/
function maskCreditCard(&$object, $field)
{
$value = $object->GetDBField($field);
$value = preg_replace('/'.substr($value, -4).'$/', str_repeat('X', 4), $value);
$object->SetDBField($field, $value);
}
/**
* Set next available order number
*
* @param kEvent $event
*/
function setNextOrderNumber($event)
{
$object = $event->getObject();
/* @var $object OrdersItem */
$sql = 'SELECT MAX(Number)
FROM ' . $this->Application->GetLiveName($object->TableName);
$next_order_number = $this->Conn->GetOne($sql) + 1;
$next_order_number = max($next_order_number, $this->Application->ConfigValue('Comm_Next_Order_Number'));
$this->Application->SetConfigValue('Comm_Next_Order_Number', $next_order_number + 1);
$object->SetDBField('Number', $next_order_number);
$object->SetDBField('SubNumber', 0);
// set virtual field too
$number_format = (int)$this->Application->ConfigValue('Comm_Order_Number_Format_P');
$sub_number_format = (int)$this->Application->ConfigValue('Comm_Order_Number_Format_S');
$order_number = sprintf('%0' . $number_format . 'd', $next_order_number) . '-' . str_repeat('0', $sub_number_format);
$object->SetDBField('OrderNumber', $order_number);
}
/**
* Set's new order address based on another address from order (e.g. billing from shipping)
*
* @param unknown_type $object
* @param unknown_type $from
* @param unknown_type $to
*/
function DoResetAddress(&$object, $from, $to)
{
$fields = Array('To','Company','Phone','Fax','Email','Address1','Address2','City','State','Zip','Country');
if ($from == 'User') {
// skip these fields when coping from user, because they are not present in user profile
$tmp_fields = array_flip($fields);
// unset($tmp_fields['Company'], $tmp_fields['Fax'], $tmp_fields['Address2']);
$fields = array_flip($tmp_fields);
}
// apply modification
foreach ($fields as $field_name) {
$object->SetDBField($to.$field_name, $object->GetDBField($from.$field_name));
}
}
/**
* Set's status incomplete to all cloned orders
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterClone(kEvent $event)
{
parent::OnAfterClone($event);
$id = $event->getEventParam('id');
$config = $event->getUnitConfig();
// set cloned order status to Incomplete
$sql = 'UPDATE ' . $config->getTableName() . '
SET Status = 0
WHERE ' . $config->getIDField() . ' = ' . $id;
$this->Conn->Query($sql);
}
/* ======================== COMMON CODE ======================== */
/**
* Split one timestamp field into 2 virtual fields
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
$object = $event->getObject();
/* @var $object kDBItem */
// get user fields
$user_id = $object->GetDBField('PortalUserId');
if ( $user_id ) {
$sql = 'SELECT *, CONCAT(FirstName,\' \',LastName) AS UserTo
FROM ' . TABLE_PREFIX . 'Users
WHERE PortalUserId = ' . $user_id;
$user_info = $this->Conn->GetRow($sql);
$fields = Array(
'UserTo'=>'UserTo','UserPhone'=>'Phone','UserFax'=>'Fax','UserEmail'=>'Email',
'UserAddress1'=>'Street','UserAddress2'=>'Street2','UserCity'=>'City','UserState'=>'State',
'UserZip'=>'Zip','UserCountry'=>'Country','UserCompany'=>'Company'
);
foreach ($fields as $object_field => $user_field) {
$object->SetDBField($object_field, $user_info[$user_field]);
}
}
$object->SetDBField('PaymentCVV2', $this->Application->RecallVar('CVV2Code'));
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
$cs_helper->PopulateStates($event, 'ShippingState', 'ShippingCountry');
$cs_helper->PopulateStates($event, 'BillingState', 'BillingCountry');
$this->SetStepRequiredFields($event);
// needed in OnAfterItemUpdate
$this->Application->SetVar('OriginalShippingOption', $object->GetDBField('ShippingOption'));
}
/**
* Processes states
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemCreate(kEvent $event)
{
parent::OnBeforeItemCreate($event);
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
$cs_helper->PopulateStates($event, 'ShippingState', 'ShippingCountry');
$cs_helper->PopulateStates($event, 'BillingState', 'BillingCountry');
}
/**
* Processes states
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemUpdate(kEvent $event)
{
parent::OnBeforeItemUpdate($event);
$object = $event->getObject();
/* @var $object OrdersItem */
$old_payment_type = $object->GetOriginalField('PaymentType');
$new_payment_type = $object->GetDBField('PaymentType');
if ( $new_payment_type != $old_payment_type ) {
// payment type changed -> check that it's allowed
$available_payment_types = $this->Application->siteDomainField('PaymentTypes');
if ( $available_payment_types ) {
if ( strpos($available_payment_types, '|' . $new_payment_type . '|') === false ) {
// payment type isn't allowed in site domain
$object->SetDBField('PaymentType', $old_payment_type);
}
}
}
$cs_helper = $this->Application->recallObject('CountryStatesHelper');
/* @var $cs_helper kCountryStatesHelper */
$cs_helper->PopulateStates($event, 'ShippingState', 'ShippingCountry');
$cs_helper->PopulateStates($event, 'BillingState', 'BillingCountry');
if ( $object->HasTangibleItems() ) {
$cs_helper->CheckStateField($event, 'ShippingState', 'ShippingCountry', false);
}
$cs_helper->CheckStateField($event, 'BillingState', 'BillingCountry', false);
if ( $object->GetDBField('Status') > ORDER_STATUS_PENDING ) {
return ;
}
$this->CheckUser($event);
if ( !$object->GetDBField('OrderIP') ) {
$object->SetDBField('OrderIP', $this->Application->getClientIp());
}
$shipping_option = $this->Application->GetVar('OriginalShippingOption');
$new_shipping_option = $object->GetDBField('ShippingOption');
if ( $shipping_option != $new_shipping_option ) {
$this->UpdateShippingOption($event);
}
else {
$this->UpdateShippingTypes($event);
}
$this->RecalculateProcessingFee($event);
$this->UpdateShippingTotal($event);
$this->RecalculateGift($event);
// guess fields from "One Step Checkout" form
if ( $object->GetDBField('PaymentAccount') ) {
$order_helper = $this->Application->recallObject('OrderHelper');
/* @var $order_helper OrderHelper */
$object->SetDBField('PaymentCardType', $order_helper->getCreditCartType($object->GetDBField('PaymentAccount')));
}
else {
$object->SetDBField('PaymentCardType', '');
}
if ( !$object->GetDBField('PaymentNameOnCard') ) {
$object->SetDBField('PaymentNameOnCard', $object->GetDBField('BillingTo'));
}
if ( is_object($event->MasterEvent) && $event->MasterEvent->Name == 'OnUpdateAjax' && $this->Application->GetVar('create_account') && $object->Validate() ) {
$this->createAccountFromOrder($event);
}
}
/**
* Creates user account
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function createAccountFromOrder($event)
{
$order = $event->getObject();
/* @var $order OrdersItem */
$order_helper = $this->Application->recallObject('OrderHelper');
/* @var $order_helper OrderHelper */
$user_fields = $order_helper->getUserFields($order);
$user_fields['Password'] = $order->GetDBField('UserPassword_plain');
$user_fields['VerifyPassword'] = $order->GetDBField('VerifyUserPassword_plain');
if ( $order->GetDBField('PortalUserId') == USER_GUEST ) {
// will also auto-login user when created
$this->Application->SetVar('u_register', Array (USER_GUEST => $user_fields));
$this->Application->HandleEvent(new kEvent('u.register:OnCreate'));
}
else {
$user = $this->Application->recallObject('u.current');
/* @var $user UsersItem */
$user->SetFieldsFromHash($user_fields);
if ( !$user->Update() ) {
$order->SetError('BillingEmail', $user->GetErrorPseudo('Email'));
}
}
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object = $event->getObject();
/* @var $object kDBList */
$types = $event->getEventParam('types');
if ( $types == 'myorders' || $types == 'myrecentorders' ) {
$user_id = $this->Application->RecallVar('user_id');
$object->addFilter('myitems_user1', '%1$s.PortalUserId = ' . $user_id);
$object->addFilter('myitems_user2', '%1$s.PortalUserId > 0');
$object->addFilter('Status', '%1$s.Status != 0');
}
else if ($event->Special == 'returns') {
// $object->addFilter('returns_filter',TABLE_PREFIX.'Orders.Status = '.ORDER_STATUS_PROCESSED.' AND (
// SELECT SUM(ReturnType)
// FROM '.TABLE_PREFIX.'OrderItems oi
// WHERE oi.OrderId = '.TABLE_PREFIX.'Orders.OrderId
// ) > 0');
$object->addFilter('returns_filter', TABLE_PREFIX . 'Orders.Status = ' . ORDER_STATUS_PROCESSED . ' AND ' . TABLE_PREFIX . 'Orders.ReturnTotal > 0');
}
else if ( $event->Special == 'user' ) {
$user_id = $this->Application->GetVar('u_id');
$object->addFilter('user_filter', '%1$s.PortalUserId = ' . $user_id);
}
else {
$special = $event->Special ? $event->Special : $this->Application->GetVar('order_type');
if ( $special != 'search' ) {
// don't filter out orders by special in case of search tab
$object->addFilter('status_filter', '%1$s.Status=' . $this->getTypeBySpecial($special));
}
if ( $event->getEventParam('selected_only') ) {
$ids = $this->StoreSelectedIDs($event);
$object->addFilter('selected_filter', '%1$s.OrderId IN (' . implode(',', $ids) . ')');
}
}
}
function getTypeBySpecial($special)
{
$special2type = Array('incomplete'=>0,'pending'=>1,'backorders'=>2,'toship'=>3,'processed'=>4,'denied'=>5,'archived'=>6);
return $special2type[$special];
}
function getSpecialByType($type)
{
$type2special = Array(0=>'incomplete',1=>'pending',2=>'backorders',3=>'toship',4=>'processed',5=>'denied',6=>'archived');
return $type2special[$type];
}
function LockTables($event)
{
$read = Array();
$write_lock = '';
$read_lock = '';
$write = Array('Orders','OrderItems','Products');
foreach ($write as $tbl) {
$write_lock .= TABLE_PREFIX.$tbl.' WRITE,';
}
foreach ($read as $tbl) {
$read_lock .= TABLE_PREFIX.$tbl.' READ,';
}
$write_lock = rtrim($write_lock, ',');
$read_lock = rtrim($read_lock, ',');
$lock = trim($read_lock.','.$write_lock, ',');
//$this->Conn->Query('LOCK TABLES '.$lock);
}
/**
* Checks shopping cart products quantities
*
* @param kEvent $event
* @return bool
*/
function CheckQuantites($event)
{
if ( $this->OnRecalculateItems($event) ) { // if something has changed in the order
if ( $this->Application->isAdminUser ) {
if ( $this->UseTempTables($event) ) {
$event->redirect = 'in-commerce/orders/orders_edit_items';
}
}
else {
$event->redirect = $this->Application->GetVar('viewcart_template');
}
return false;
}
return true;
}
function DoPlaceOrder($event)
{
$order = $event->getObject();
$table_prefix = $this->TablePrefix($event);
$this->LockTables($event);
if (!$this->CheckQuantites($event)) return false;
//everything is fine - we could reserve items
$this->ReserveItems($event);
$this->SplitOrder($event, $order);
return true;
}
function &queryOrderItems($event, $table_prefix)
{
$order = $event->getObject();
$ord_id = $order->GetId();
// TABLE_PREFIX and $table_prefix are NOT the same !!!
$poc_table = $this->Application->getUnitConfig('poc')->getTableName();
$query = ' SELECT
BackOrderFlag, '.
$table_prefix.'OrderItems.OrderItemId, '.
$table_prefix.'OrderItems.Quantity, '.
$table_prefix.'OrderItems.QuantityReserved,
IF('.TABLE_PREFIX.'Products.InventoryStatus = 2, '.$poc_table.'.QtyInStock, '.TABLE_PREFIX.'Products.QtyInStock) AS QtyInStock, '.
TABLE_PREFIX.'Products.QtyInStockMin, '.
$table_prefix.'OrderItems.ProductId, '.
TABLE_PREFIX.'Products.InventoryStatus,'.
$table_prefix.'OrderItems.OptionsSalt AS CombinationCRC
FROM '.$table_prefix.'OrderItems
LEFT JOIN '.TABLE_PREFIX.'Products ON '.TABLE_PREFIX.'Products.ProductId = '.$table_prefix.'OrderItems.ProductId
LEFT JOIN '.$poc_table.' ON ('.$poc_table.'.CombinationCRC = '.$table_prefix.'OrderItems.OptionsSalt) AND ('.$poc_table.'.ProductId = '.$table_prefix.'OrderItems.ProductId)
WHERE OrderId = '.$ord_id.' AND '.TABLE_PREFIX.'Products.Type = 1
ORDER BY BackOrderFlag ASC';
$items = $this->Conn->Query($query);
return $items;
}
function ReserveItems($event)
{
$table_prefix = $this->TablePrefix($event);
$items =& $this->queryOrderItems($event, $table_prefix);
foreach ($items as $an_item) {
if (!$an_item['InventoryStatus']) {
$to_reserve = $an_item['Quantity'] - $an_item['QuantityReserved'];
}
else {
if ($an_item['BackOrderFlag'] > 0) { // we don't need to reserve if it's backordered item
$to_reserve = 0;
}
else {
$to_reserve = min($an_item['Quantity']-$an_item['QuantityReserved'], $an_item['QtyInStock']-$an_item['QtyInStockMin']); //it should be equal, but just in case
}
$to_backorder = $an_item['BackOrderFlag'] > 0 ? $an_item['Quantity']-$an_item['QuantityReserved'] : 0;
}
if ($to_backorder < 0) $to_backorder = 0; //just in case
$query = ' UPDATE '.$table_prefix.'OrderItems
SET QuantityReserved = IF(QuantityReserved IS NULL, '.$to_reserve.', QuantityReserved + '.$to_reserve.')
WHERE OrderItemId = '.$an_item['OrderItemId'];
$this->Conn->Query($query);
if (!$an_item['InventoryStatus']) continue;
$update_clause = ' QtyInStock = QtyInStock - '.$to_reserve.',
QtyReserved = QtyReserved + '.$to_reserve.',
QtyBackOrdered = QtyBackOrdered + '.$to_backorder;
if ($an_item['InventoryStatus'] == 1) {
// inventory by product, then update it's quantities
$query = ' UPDATE '.TABLE_PREFIX.'Products
SET '.$update_clause.'
WHERE ProductId = '.$an_item['ProductId'];
}
else {
// inventory = 2 -> by product option combinations
$poc_table = $this->Application->getUnitConfig('poc')->getTableName();
$query = ' UPDATE '.$poc_table.'
SET '.$update_clause.'
WHERE (ProductId = '.$an_item['ProductId'].') AND (CombinationCRC = '.$an_item['CombinationCRC'].')';
}
$this->Conn->Query($query);
}
}
function FreeItems($event)
{
$table_prefix = $this->TablePrefix($event);
$items =& $this->queryOrderItems($event, $table_prefix);
foreach ($items as $an_item) {
$to_free = $an_item['QuantityReserved'];
if ($an_item['InventoryStatus']) {
if ($an_item['BackOrderFlag'] > 0) { // we don't need to free if it's backordered item
$to_free = 0;
}
// what's not reserved goes to backorder in stock for orderitems marked with BackOrderFlag
$to_backorder_free = $an_item['BackOrderFlag'] > 0 ? $an_item['Quantity'] - $an_item['QuantityReserved'] : 0;
if ($to_backorder_free < 0) $to_backorder_free = 0; //just in case
$update_clause = ' QtyInStock = QtyInStock + '.$to_free.',
QtyReserved = QtyReserved - '.$to_free.',
QtyBackOrdered = QtyBackOrdered - '.$to_backorder_free;
if ($an_item['InventoryStatus'] == 1) {
// inventory by product
$query = ' UPDATE '.TABLE_PREFIX.'Products
SET '.$update_clause.'
WHERE ProductId = '.$an_item['ProductId'];
}
else {
// inventory by option combinations
$poc_table = $this->Application->getUnitConfig('poc')->getTableName();
$query = ' UPDATE '.$poc_table.'
SET '.$update_clause.'
WHERE (ProductId = '.$an_item['ProductId'].') AND (CombinationCRC = '.$an_item['CombinationCRC'].')';
}
$this->Conn->Query($query);
}
$query = ' UPDATE '.$table_prefix.'OrderItems
SET QuantityReserved = IF(QuantityReserved IS NULL, 0, QuantityReserved - '.$to_free.')
WHERE OrderItemId = '.$an_item['OrderItemId'];
$this->Conn->Query($query);
}
}
/**
* Enter description here...
*
* @param kEvent $event
* @param OrdersItem $object
*/
function SplitOrder($event, &$object)
{
$affiliate_event = new kEvent('affil:OnOrderApprove');
$affiliate_event->setEventParam('Order_PrefixSpecial', $object->getPrefixSpecial() );
$this->Application->HandleEvent($affiliate_event);
$table_prefix = $this->TablePrefix($event);
$order =& $object;
$ord_id = $order->GetId();
$shipping_option = $order->GetDBField('ShippingOption');
$backorder_select = $shipping_option == 0 ? '0' : 'oi.BackOrderFlag';
// setting PackageNum to 0 for Non-tangible items, for tangibles first package num is always 1
$query = ' SELECT oi.OrderItemId
FROM ' . $table_prefix . 'OrderItems oi
LEFT JOIN ' . TABLE_PREFIX . 'Products p ON p.ProductId = oi.ProductId
WHERE p.Type > 1 AND oi.OrderId = ' . $ord_id;
$non_tangibles = $this->Conn->GetCol($query);
if ($non_tangibles) {
$query = ' UPDATE ' . $table_prefix . 'OrderItems
SET PackageNum = 0
WHERE OrderItemId IN (' . implode(',', $non_tangibles) . ')';
$this->Conn->Query($query);
}
// grouping_data:
// 0 => Product Type
// 1 => if NOT tangibale and NOT downloadable - OrderItemId,
// 2 => ProductId
// 3 => Shipping PackageNum
$query = 'SELECT
'.$backorder_select.' AS BackOrderFlagCalc,
PackageNum,
ProductName,
ShippingTypeId,
CONCAT('.TABLE_PREFIX.'Products.Type,
"_",
IF ('.TABLE_PREFIX.'Products.Type NOT IN ('.PRODUCT_TYPE_DOWNLOADABLE.','.PRODUCT_TYPE_TANGIBLE.'),
CONCAT(OrderItemId, "_", '.TABLE_PREFIX.'Products.ProductId),
""),
"_",
PackageNum
) AS Grouping,
SUM(Quantity) AS TotalItems,
SUM('.$table_prefix.'OrderItems.Weight*Quantity) AS TotalWeight,
SUM(Price * Quantity) AS TotalAmount,
SUM(QuantityReserved) AS TotalReserved,
'.TABLE_PREFIX.'Products.Type AS ProductType
FROM '.$table_prefix.'OrderItems
LEFT JOIN '.TABLE_PREFIX.'Products
ON '.TABLE_PREFIX.'Products.ProductId = '.$table_prefix.'OrderItems.ProductId
WHERE OrderId = '.$ord_id.'
GROUP BY BackOrderFlagCalc, Grouping
ORDER BY BackOrderFlagCalc ASC, PackageNum ASC, ProductType ASC';
$sub_orders = $this->Conn->Query($query);
$processed_sub_orders = Array();
// in case of recurring billing this will not be 0 as usual
//$first_sub_number = ($event->Special == 'recurring') ? $object->getNextSubNumber() - 1 : 0;
$first_sub_number = $object->GetDBField('SubNumber');
$next_sub_number = $first_sub_number;
$group = 1;
$order_has_gift = $order->GetDBField('GiftCertificateDiscount') > 0 ? 1 : 0;
$skip_types = Array (PRODUCT_TYPE_TANGIBLE, PRODUCT_TYPE_DOWNLOADABLE);
foreach ($sub_orders as $sub_order_data) {
$sub_order = $this->Application->recallObject('ord.-sub'.$next_sub_number, 'ord');
/* @var $sub_order OrdersItem */
if ($this->UseTempTables($event) && $next_sub_number == 0) {
$sub_order =& $order;
}
$sub_order->SetDBFieldsFromHash($order->GetFieldValues());
$sub_order->SetDBField('SubNumber', $next_sub_number);
$sub_order->SetDBField('SubTotal', $sub_order_data['TotalAmount']);
$grouping_data = explode('_', $sub_order_data['Grouping']);
$named_grouping_data['Type'] = $grouping_data[0];
if (!in_array($named_grouping_data['Type'], $skip_types)) {
$named_grouping_data['OrderItemId'] = $grouping_data[1];
$named_grouping_data['ProductId'] = $grouping_data[2];
$named_grouping_data['PackageNum'] = $grouping_data[3];
}
else {
$named_grouping_data['PackageNum'] = $grouping_data[2];
}
if ($named_grouping_data['Type'] == PRODUCT_TYPE_TANGIBLE) {
$sub_order->SetDBField('ShippingCost', getArrayValue( unserialize($order->GetDBField('ShippingInfo')), $sub_order_data['PackageNum'], 'TotalCost') );
$sub_order->SetDBField('InsuranceFee', getArrayValue( unserialize($order->GetDBField('ShippingInfo')), $sub_order_data['PackageNum'], 'InsuranceFee') );
$sub_order->SetDBField('ShippingInfo', serialize(Array(1 => getArrayValue( unserialize($order->GetDBField('ShippingInfo')), $sub_order_data['PackageNum']))));
}
else {
$sub_order->SetDBField('ShippingCost', 0);
$sub_order->SetDBField('InsuranceFee', 0);
$sub_order->SetDBField('ShippingInfo', ''); //otherwise orders w/o shipping wills still have shipping info!
}
$amount_percent = $sub_order->getTotalAmount() * 100 / $order->getTotalAmount();
// proportional affiliate commission splitting
if ($order->GetDBField('AffiliateCommission') > 0) {
$sub_order->SetDBField('AffiliateCommission', $order->GetDBField('AffiliateCommission') * $amount_percent / 100 );
}
$amount_percent = ($sub_order->GetDBField('SubTotal') + $sub_order->GetDBField('ShippingCost')) * 100 / ($order->GetDBField('SubTotal') + $order->GetDBField('ShippingCost'));
if ($order->GetDBField('ProcessingFee') > 0) {
$sub_order->SetDBField('ProcessingFee', round($order->GetDBField('ProcessingFee') * $amount_percent / 100, 2));
}
$sub_order->RecalculateTax();
$original_amount = $sub_order->GetDBField('SubTotal') + $sub_order->GetDBField('ShippingCost') + $sub_order->GetDBField('VAT') + $sub_order->GetDBField('ProcessingFee') + $sub_order->GetDBField('InsuranceFee') - $sub_order->GetDBField('GiftCertificateDiscount');
$sub_order->SetDBField('OriginalAmount', $original_amount);
if ($named_grouping_data['Type'] == 1 && ($sub_order_data['BackOrderFlagCalc'] > 0
||
($sub_order_data['TotalItems'] != $sub_order_data['TotalReserved'])) ) {
$sub_order->SetDBField('Status', ORDER_STATUS_BACKORDERS);
if ($event->Special != 'recurring') { // just in case if admin uses tangible backordered products in recurring orders
$this->Application->emailUser('BACKORDER.ADD', null, $this->OrderEmailParams($sub_order));
$this->Application->emailAdmin('BACKORDER.ADD');
}
}
else {
switch ($named_grouping_data['Type']) {
case PRODUCT_TYPE_DOWNLOADABLE:
$sql = 'SELECT oi.*
FROM '.TABLE_PREFIX.'OrderItems oi
LEFT JOIN '.TABLE_PREFIX.'Products p ON p.ProductId = oi.ProductId
WHERE (OrderId = %s) AND (p.Type = '.PRODUCT_TYPE_DOWNLOADABLE.')';
$downl_products = $this->Conn->Query( sprintf($sql, $ord_id) );
$product_ids = Array();
foreach ($downl_products as $downl_product) {
$this->raiseProductEvent('Approve', $downl_product['ProductId'], $downl_product, $next_sub_number);
$product_ids[] = $downl_product['ProductId'];
}
break;
case PRODUCT_TYPE_TANGIBLE:
$sql = 'SELECT '.$backorder_select.' AS BackOrderFlagCalc, oi.*
FROM '.TABLE_PREFIX.'OrderItems oi
LEFT JOIN '.TABLE_PREFIX.'Products p ON p.ProductId = oi.ProductId
- WHERE (OrderId = %s) AND (BackOrderFlagCalc = 0) AND (p.Type = '.PRODUCT_TYPE_TANGIBLE.')';
+ WHERE (OrderId = %s) AND (p.Type = '.PRODUCT_TYPE_TANGIBLE.')
+ HAVING BackOrderFlagCalc = 0';
$products = $this->Conn->Query( sprintf($sql, $ord_id) );
foreach ($products as $product) {
$this->raiseProductEvent('Approve', $product['ProductId'], $product, $next_sub_number);
}
break;
default:
$order_item_fields = $this->Conn->GetRow('SELECT * FROM '.TABLE_PREFIX.'OrderItems WHERE OrderItemId = '.$named_grouping_data['OrderItemId']);
$this->raiseProductEvent('Approve', $named_grouping_data['ProductId'], $order_item_fields, $next_sub_number);
break;
}
$sub_order->SetDBField('Status', $named_grouping_data['Type'] == PRODUCT_TYPE_TANGIBLE ? ORDER_STATUS_TOSHIP : ORDER_STATUS_PROCESSED);
}
if ($next_sub_number == $first_sub_number) {
$sub_order->SetId($order->GetId());
$sub_order->Update();
}
else {
$sub_order->Create();
}
switch ($named_grouping_data['Type']) {
case PRODUCT_TYPE_TANGIBLE:
$query = 'UPDATE '.$table_prefix.'OrderItems SET OrderId = %s WHERE OrderId = %s AND PackageNum = %s';
$query = sprintf($query, $sub_order->GetId(), $ord_id, $sub_order_data['PackageNum']);
break;
case PRODUCT_TYPE_DOWNLOADABLE:
$query = 'UPDATE '.$table_prefix.'OrderItems SET OrderId = %s WHERE OrderId = %s AND ProductId IN (%s)';
$query = sprintf($query, $sub_order->GetId(), $ord_id, implode(',', $product_ids) );
break;
default:
$query = 'UPDATE '.$table_prefix.'OrderItems SET OrderId = %s WHERE OrderId = %s AND OrderItemId = %s';
$query = sprintf($query, $sub_order->GetId(), $ord_id, $named_grouping_data['OrderItemId']);
break;
}
$this->Conn->Query($query);
if ($order_has_gift) {
// gift certificate can be applied only after items are assigned to suborder
$sub_order->RecalculateGift($event);
$original_amount = $sub_order->GetDBField('SubTotal') + $sub_order->GetDBField('ShippingCost') + $sub_order->GetDBField('VAT') + $sub_order->GetDBField('ProcessingFee') + $sub_order->GetDBField('InsuranceFee') - $sub_order->GetDBField('GiftCertificateDiscount');
$sub_order->SetDBField('OriginalAmount', $original_amount);
$sub_order->Update();
}
$processed_sub_orders[] = $sub_order->GetID();
$next_sub_number++;
$group++;
}
foreach ($processed_sub_orders as $sub_id) {
// update DiscountTotal field
$sql = 'SELECT SUM(ROUND(FlatPrice-Price,2)*Quantity) FROM '.$table_prefix.'OrderItems WHERE OrderId = '.$sub_id;
$discount_total = $this->Conn->GetOne($sql);
$sql = 'UPDATE '.$sub_order->TableName.'
SET DiscountTotal = '.$this->Conn->qstr($discount_total).'
WHERE OrderId = '.$sub_id;
$this->Conn->Query($sql);
}
}
/**
* Call products linked event when spefcfic action is made to product in order
*
* @param string $event_type type of event to get from product ProcessingData = {Approve,Deny,CompleteOrder}
* @param int $product_id ID of product to gather processing data from
* @param Array $order_item_fields OrderItems table record fields (with needed product & order in it)
*/
function raiseProductEvent($event_type, $product_id, $order_item_fields, $next_sub_number=null)
{
$sql = 'SELECT ProcessingData
FROM '.TABLE_PREFIX.'Products
WHERE ProductId = '.$product_id;
$processing_data = $this->Conn->GetOne($sql);
if ($processing_data) {
$processing_data = unserialize($processing_data);
$event_key = getArrayValue($processing_data, $event_type.'Event');
// if requested type of event is defined for product, only then process it
if ($event_key) {
$event = new kEvent($event_key);
$event->setEventParam('field_values', $order_item_fields);
$event->setEventParam('next_sub_number', $next_sub_number);
$this->Application->HandleEvent($event);
}
}
}
function OptionsSalt($options, $comb_only=false)
{
$helper = $this->Application->recallObject('kProductOptionsHelper');
return $helper->OptionsSalt($options, $comb_only);
}
/**
* Enter description here...
*
* @param kEvent $event
* @param int $item_id
*/
function AddItemToOrder($event, $item_id, $qty = null, $package_num = null)
{
if (!isset($qty)) {
$qty = 1;
}
// Loading product to add
$product = $this->Application->recallObject('p.toadd', null, Array('skip_autoload' => true));
/* @var $product kDBItem */
$product->Load($item_id);
$object = $this->Application->recallObject('orditems.-item', null, Array('skip_autoload' => true));
/* @var $object kDBItem */
$order = $this->Application->recallObject('ord');
/* @var $order kDBItem */
if (!$order->isLoaded() && !$this->Application->isAdmin) {
// no order was created before -> create one now
if ($this->_createNewCart($event)) {
$this->LoadItem($event);
}
}
if (!$order->isLoaded()) {
// was unable to create new order
return false;
}
$item_data = $event->getEventParam('ItemData');
$item_data = $item_data ? unserialize($item_data) : Array ();
$options = getArrayValue($item_data, 'Options');
if ( !$this->CheckOptions($event, $options, $item_id, $qty, $product->GetDBField('OptionsSelectionMode')) ) {
return;
}
$manager = $this->Application->recallObject('OrderManager');
/* @var $manager OrderManager */
$manager->setOrder($order);
$manager->addProduct($product, $event->getEventParam('ItemData'), $qty, $package_num);
$this->Application->HandleEvent(new kEvent('ord:OnRecalculateItems'));
}
/**
* Enter description here...
*
* @param kEvent $event
*/
function UpdateShippingTotal($event)
{
if ( $this->Application->GetVar('ebay_notification') == 1 ) {
// TODO: get rid of this "if"
return;
}
$object = $event->getObject();
/* @var $object OrdersItem */
$shipping_total = $insurance_fee = 0;
$shipping_info = $object->GetDBField('ShippingInfo') ? unserialize($object->GetDBField('ShippingInfo')) : false;
if ( is_array($shipping_info) ) {
foreach ($shipping_info as $a_shipping) {
// $id_elements = explode('_', $a_shipping['ShippingTypeId']);
$shipping_total += $a_shipping['TotalCost'];
$insurance_fee += $a_shipping['InsuranceFee'];
}
}
$object->SetDBField('ShippingCost', $shipping_total);
$object->SetDBField('InsuranceFee', $insurance_fee);
// no need to update, it will be called in calling method
$this->RecalculateTax($event);
}
/**
* Recompile shopping cart, splitting or grouping orders and backorders depending on total quantities.
* First it counts total qty for each ProductId, and then creates order for available items
* and backorder for others. It also updates the sub-total for the order
*
* @param kEvent $event
* @return bool Returns true if items splitting/grouping were changed
*/
function OnRecalculateItems($event)
{
if (is_object($event->MasterEvent) && ($event->MasterEvent->status != kEvent::erSUCCESS)) {
// e.g. master order update failed, don't recalculate order products
return ;
}
$order = $event->getObject();
/* @var $order OrdersItem */
if ( !$order->isLoaded() ) {
$this->LoadItem($event); // try to load
}
$ord_id = (int)$order->GetID();
if ( !$order->isLoaded() ) return; //order has not been created yet
if( $order->GetDBField('Status') != ORDER_STATUS_INCOMPLETE )
{
return;
}
$manager = $this->Application->recallObject('OrderManager');
/* @var $manager OrderManager */
$manager->setOrder($order);
$result = $manager->calculate();
if ( $order->GetDBField('CouponId') && $order->GetDBField('CouponDiscount') == 0 ) {
$this->RemoveCoupon($order);
$order->setCheckoutError(OrderCheckoutErrorType::COUPON, OrderCheckoutError::COUPON_REMOVED_AUTOMATICALLY);
}
if ( $result ) {
$this->UpdateShippingOption($event);
}
$this->UpdateShippingTotal($event);
$this->RecalculateProcessingFee($event);
$this->RecalculateTax($event);
$this->RecalculateGift($event);
if ( $event->Name != 'OnAfterItemUpdate' ) {
$order->Update();
}
$event->setEventParam('RecalculateChangedCart', $result);
if ( is_object($event->MasterEvent) ) {
$event->MasterEvent->setEventParam('RecalculateChangedCart', $result);
}
/*if ( $result && !getArrayValue($event->redirect_params, 'checkout_error') ) {
$event->SetRedirectParam('checkout_error', OrderCheckoutError::STATE_CHANGED);
}*/
if ( $result && is_object($event->MasterEvent) && $event->MasterEvent->Name == 'OnUserLogin' ) {
$shop_cart_template = $this->Application->GetVar('shop_cart_template');
if ( $shop_cart_template && is_object($event->MasterEvent->MasterEvent) ) {
// $event->MasterEvent->MasterEvent->SetRedirectParam('checkout_error', OrderCheckoutError::CHANGED_AFTER_LOGIN);
$event->MasterEvent->MasterEvent->redirect = $shop_cart_template;
}
}
return $result;
}
/* function GetShippingCost($user_country_id, $user_state_id, $user_zip, $weight, $items, $amount, $shipping_type)
{
$this->Application->recallObject('ShippingQuoteEngine');
$shipping_h = $this->Application->recallObject('CustomShippingQuoteEngine');
$query = $shipping_h->QueryShippingCost($user_country_id, $user_state_id, $user_zip, $weight, $items, $amount, $shipping_type);
$cost = $this->Conn->GetRow($query);
return $cost['TotalCost'];
}*/
/**
* Return product pricing id for given product, if not passed - return primary pricing ID
*
* @param int $product_id ProductId
* @return float
*/
function GetPricingId($product_id, $item_data) {
if (!is_array($item_data)) {
$item_data = unserialize($item_data);
}
$price_id = getArrayValue($item_data, 'PricingId');
if (!$price_id) {
$price_id = $this->Application->GetVar('pr_id');
}
if (!$price_id){
$price_id = $this->Conn->GetOne('SELECT PriceId FROM '.TABLE_PREFIX.'ProductsPricing WHERE ProductId='.$product_id.' AND IsPrimary=1');
}
return $price_id;
}
function UpdateShippingOption($event)
{
$object = $event->getObject();
$shipping_option = $object->GetDBField('ShippingOption');
if($shipping_option == '') return;
$table_prefix = $this->TablePrefix($event);
if ($shipping_option == 1 || $shipping_option == 0) { // backorder separately
$query = 'UPDATE '.$table_prefix.'OrderItems SET BackOrderFlag = 1 WHERE OrderId = '.$object->GetId().' AND BackOrderFlag > 1';
$this->Conn->Query($query);
}
if ($shipping_option == 2) {
$query = 'SELECT * FROM '.$table_prefix.'OrderItems WHERE OrderId = '.$object->GetId().' AND BackOrderFlag >= 1 ORDER By ProductName asc';
$items = $this->Conn->Query($query);
$backorder_flag = 2;
foreach ($items as $an_item) {
$query = 'UPDATE '.$table_prefix.'OrderItems SET BackOrderFlag = '.$backorder_flag.' WHERE OrderItemId = '.$an_item['OrderItemId'];
$this->Conn->Query($query);
$backorder_flag++;
}
}
}
/**
* Updates shipping types
*
* @param kEvent $event
* @return bool
*/
function UpdateShippingTypes($event)
{
$object = $event->getObject();
/* @var $object OrdersItem */
$ord_id = $object->GetID();
$order_info = $this->Application->GetVar('ord');
$shipping_ids = getArrayValue($order_info, $ord_id, 'ShippingTypeId');
if (!$shipping_ids) {
return;
}
$ret = true;
$shipping_types = Array();
$last_shippings = unserialize( $this->Application->RecallVar('LastShippings') );
$template = $this->Application->GetVar('t');
$shipping_templates = Array ('in-commerce/checkout/shipping', 'in-commerce/orders/orders_edit_shipping');
$quote_engine_collector = $this->Application->recallObject('ShippingQuoteCollector');
/* @var $quote_engine_collector ShippingQuoteCollector */
foreach ($shipping_ids as $package => $id) {
// try to validate
$shipping_types[$package] = $last_shippings[$package][$id];
$sqe_class_name = $quote_engine_collector->GetClassByType($shipping_types, $package);
if (($object->GetDBField('ShippingType') == 0) && ($sqe_class_name !== false) && in_array($template, $shipping_templates)) {
$shipping_quote_engine = $this->Application->recallObject($sqe_class_name);
/* @var $shipping_quote_engine ShippingQuoteEngine */
// USPS related part
// TODO: remove USPS condition from here
// set first of found shippings just to check if any errors are returned
$current_usps_shipping_types = unserialize($this->Application->RecallVar('current_usps_shipping_types'));
$object->SetDBField('ShippingInfo', serialize( Array($package => $current_usps_shipping_types[$id])) );
$sqe_data = $shipping_quote_engine->MakeOrder($object, true);
if ( $sqe_data ) {
if ( !isset($sqe_data['error_number']) ) {
// update only international shipping
if ( $object->GetDBField('ShippingCountry') != 'USA') {
$shipping_types[$package]['TotalCost'] = $sqe_data['Postage'];
}
}
else {
$ret = false;
$this->Application->StoreVar('sqe_error', $sqe_data['error_description']);
}
}
$object->SetDBField('ShippingInfo', '');
}
}
$object->SetDBField('ShippingInfo', serialize($shipping_types));
return $ret;
}
/*function shipOrder(&$order_items)
{
$product_object = $this->Application->recallObject('p', null, Array('skip_autoload' => true));
$order_item = $this->Application->recallObject('orditems.-item');
while( !$order_items->EOL() )
{
$rec = $order_items->getCurrentRecord();
$order_item->SetDBFieldsFromHash($rec);
$order_item->SetId($rec['OrderItemId']);
$order_item->SetDBField('QuantityReserved', 0);
$order_item->Update();
$order_items->GoNext();
}
return true;
}*/
function RecalculateTax($event)
{
$object = $event->getObject();
/* @var $object OrdersItem */
if ($object->GetDBField('Status') > ORDER_STATUS_PENDING) {
return;
}
$object->RecalculateTax();
}
function RecalculateProcessingFee($event)
{
$object = $event->getObject();
// Do not reset processing fee while orders are being split (see SplitOrder)
if (preg_match("/^-sub/", $object->Special)) return;
if ($object->GetDBField('Status') > ORDER_STATUS_PENDING) return; //no changes for orders other than incomple or pending
$pt = $object->GetDBField('PaymentType');
$sql = 'SELECT ProcessingFee
FROM ' . $this->Application->getUnitConfig('pt')->getTableName() . '
WHERE PaymentTypeId = ' . $pt;
$processing_fee = $this->Conn->GetOne($sql);
$object->SetDBField( 'ProcessingFee', $processing_fee );
$this->UpdateTotals($event);
}
function UpdateTotals($event)
{
$object = $event->getObject();
/* @var $object OrdersItem */
$object->UpdateTotals();
}
/*function CalculateDiscount($event)
{
$object = $event->getObject();
$coupon = $this->Application->recallObject('coup', null, Array('skip_autoload' => true));
if(!$coupon->Load( $object->GetDBField('CouponId'), 'CouponId' ))
{
return false;
}
$sql = 'SELECT Price * Quantity AS Amount, ProductId FROM '.$this->Application->getUnitConfig('orditems')->getTableName().'
WHERE OrderId = '.$object->GetDBField('OrderId');
$orditems = $this->Conn->GetCol($sql, 'ProductId');
$sql = 'SELECT coupi.ItemType, p.ProductId FROM '.$this->Application->getUnitConfig('coupi')->getTableName().' coupi
LEFT JOIN '.$this->Application->getUnitConfig('p')->getTableName().' p
ON coupi.ItemResourceId = p.ResourceId
WHERE CouponId = '.$object->GetDBField('CouponId');
$discounts = $this->Conn->GetCol($sql, 'ProductId');
$discount_amount = 0;
foreach($orditems as $product_id => $amount)
{
if(isset($discounts[$product_id]) || array_search('0', $discounts, true) !== false)
{
switch($coupon->GetDBField('Type'))
{
case 1:
$discount_amount += $coupon->GetDBField('Amount') < $amount ? $coupon->GetDBField('Amount') : $amount;
break;
case 2:
$discount_amount += $amount * $coupon->GetDBField('Amount') / 100;
break;
default:
}
break;
}
}
$object->SetDBField('CouponDiscount', $discount_amount);
return $discount_amount;
}*/
/**
* Jumps to selected order in order's list from search tab
*
* @param kEvent $event
*/
function OnGoToOrder($event)
{
$id = current($this->StoreSelectedIDs($event));
$config = $event->getUnitConfig();
$id_field = $config->getIDField();
$sql = 'SELECT Status
FROM ' . $config->getTableName() . '
WHERE ' . $id_field . ' = ' . $id;
$order_status = $this->Conn->GetOne($sql);
$prefix_special = $event->Prefix.'.'.$this->getSpecialByType($order_status);
$orders_list = $this->Application->recallObject($prefix_special, $event->Prefix.'_List', Array('per_page'=>-1) );
/* @var $orders_list kDBList */
$orders_list->Query();
foreach ($orders_list->Records as $row_num => $record) {
if ( $record[$id_field] == $id ) {
break;
}
}
$per_page = $this->getPerPage( new kEvent($prefix_special.':OnDummy') );
$page = ceil( ($row_num+1) / $per_page );
$this->Application->StoreVar($prefix_special.'_Page', $page);
$event->redirect = 'in-commerce/orders/orders_'.$this->getSpecialByType($order_status).'_list';
}
/**
* Reset's any selected order state to pending
*
* @param kEvent $event
*/
function OnResetToPending($event)
{
$object = $event->getObject( Array('skip_autoload' => true) );
/* @var $object kDBItem */
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( $items_info ) {
foreach ($items_info as $id => $field_values) {
$object->Load($id);
$object->SetDBField('Status', ORDER_STATUS_PENDING);
if ( $object->Update() ) {
$event->status = kEvent::erSUCCESS;
}
else {
$event->status = kEvent::erFAIL;
$event->redirect = false;
break;
}
}
}
}
/**
* Creates list from items selected in grid
*
* @param kEvent $event
*/
function OnLoadSelected($event)
{
$event->setPseudoClass('_List');
$object = $event->getObject( Array('selected_only' => true) );
$event->redirect = false;
}
/**
* Return orders list, that will expire in time specified
*
* @param int $pre_expiration timestamp
* @return Array
*/
function getRecurringOrders($pre_expiration)
{
$config = $this->Application->getUnitConfig('ord');
$ord_id_field = $config->getIDField();
$processing_allowed = Array(ORDER_STATUS_PROCESSED, ORDER_STATUS_ARCHIVED);
$sql = 'SELECT '.$ord_id_field.', PortalUserId, GroupId, NextCharge
FROM '. $config->getTableName() .'
WHERE (IsRecurringBilling = 1) AND (NextCharge < '.$pre_expiration.') AND Status IN ('.implode(',', $processing_allowed).')';
return $this->Conn->Query($sql, $ord_id_field);
}
/**
* [SCHEDULED TASK] Checks what orders should expire and renew automatically (if such flag set)
*
* @param kEvent $event
*/
function OnCheckRecurringOrders($event)
{
$skip_clause = Array();
$pre_expiration = adodb_mktime() + $this->Application->ConfigValue('Comm_RecurringChargeInverval') * 3600 * 24;
$to_charge = $this->getRecurringOrders($pre_expiration);
if ($to_charge) {
$order_ids = Array();
foreach ($to_charge as $order_id => $record) {
// skip virtual users (e.g. root, guest, etc.) & invalid subscriptions (with no group specified, no next charge, but Recurring flag set)
if (!$record['PortalUserId'] || !$record['GroupId'] || !$record['NextCharge']) continue;
$order_ids[] = $order_id;
// prevent duplicate user+group pairs
$skip_clause[ 'PortalUserId = '.$record['PortalUserId'].' AND GroupId = '.$record['GroupId'] ] = $order_id;
}
// process only valid orders
$temp_handler = $this->Application->recallObject($event->Prefix.'_TempHandler', 'kTempTablesHandler', Array ('parent_event' => $event));
/* @var $temp_handler kTempTablesHandler */
$cloned_order_ids = $temp_handler->CloneItems($event->Prefix, 'recurring', $order_ids);
$order =& $this->Application->recallObject($event->Prefix.'.recurring', null, Array('skip_autoload' => true));
foreach ($cloned_order_ids as $order_id) {
$order->Load($order_id);
$this->Application->HandleEvent($complete_event, $event->Prefix.'.recurring:OnCompleteOrder' );
if ($complete_event->status == kEvent::erSUCCESS) {
//send recurring ok email
$this->Application->emailUser('ORDER.RECURRING.PROCESSED', null, $this->OrderEmailParams($order));
$this->Application->emailAdmin('ORDER.RECURRING.PROCESSED');
}
else {
//send Recurring failed event
$order->SetDBField('Status', ORDER_STATUS_DENIED);
$order->Update();
$this->Application->emailUser('ORDER.RECURRING.DENIED', null, $this->OrderEmailParams($order));
$this->Application->emailAdmin('ORDER.RECURRING.DENIED');
}
}
// remove recurring flag from all orders found, not to select them next time script runs
$config = $event->getUnitConfig();
$sql = 'UPDATE '. $config->getTableName() .'
SET IsRecurringBilling = 0
WHERE '. $config->getIDField() .' IN ('.implode(',', array_keys($to_charge)).')';
$this->Conn->Query($sql);
}
if ( !is_object($event->MasterEvent) ) {
// not called as hook
return ;
}
$pre_expiration = adodb_mktime() + $this->Application->ConfigValue('User_MembershipExpirationReminder') * 3600 * 24;
$to_charge = $this->getRecurringOrders($pre_expiration);
foreach ($to_charge as $order_id => $record) {
// skip virtual users (e.g. root, guest, etc.) & invalid subscriptions (with no group specified, no next charge, but Recurring flag set)
if (!$record['PortalUserId'] || !$record['GroupId'] || !$record['NextCharge']) continue;
// prevent duplicate user+group pairs
$skip_clause[ 'PortalUserId = '.$record['PortalUserId'].' AND GroupId = '.$record['GroupId'] ] = $order_id;
}
$skip_clause = array_flip($skip_clause);
$event->MasterEvent->setEventParam('skip_clause', $skip_clause);
}
function OnGeneratePDF($event)
{
$this->OnLoadSelected($event);
$this->Application->InitParser();
$o = $this->Application->ParseBlock(array('name'=>'in-commerce/orders/orders_pdf'));
$file_helper = $this->Application->recallObject('FileHelper');
/* @var $file_helper FileHelper */
$file_helper->CheckFolder(EXPORT_PATH);
$htmlFile = EXPORT_PATH . '/tmp.html';
$fh = fopen($htmlFile, 'w');
fwrite($fh, $o);
fclose($fh);
// return;
// require_once (FULL_PATH.'html2pdf/PDFEncryptor.php');
// Full path to the file to be converted
// $htmlFile = dirname(__FILE__) . '/test.html';
// The default domain for images that use a relative path
// (you'll need to change the paths in the test.html page
// to an image on your server)
$defaultDomain = DOMAIN;
// Full path to the PDF we are creating
$pdfFile = EXPORT_PATH . '/tmp.pdf';
// Remove old one, just to make sure we are making it afresh
@unlink($pdfFile);
$pdf_helper = $this->Application->recallObject('kPDFHelper');
$pdf_helper->FileToFile($htmlFile, $pdfFile);
return ;
// DOM PDF VERSION
/*require_once(FULL_PATH.'/dompdf/dompdf_config.inc.php');
$dompdf = new DOMPDF();
$dompdf->load_html_file($htmlFile);
if ( isset($base_path) ) {
$dompdf->set_base_path($base_path);
}
$dompdf->set_paper($paper, $orientation);
$dompdf->render();
file_put_contents($pdfFile, $dompdf->output());
return ;*/
// Instnatiate the class with our variables
require_once (FULL_PATH.'/html2pdf/HTML_ToPDF.php');
$pdf = new HTML_ToPDF($htmlFile, $defaultDomain, $pdfFile);
$pdf->setHtml2Ps('/usr/bin/html2ps');
$pdf->setPs2Pdf('/usr/bin/ps2pdf');
$pdf->setGetUrl('/usr/local/bin/curl -i');
// Set headers/footers
$pdf->setHeader('color', 'black');
$pdf->setFooter('left', '');
$pdf->setFooter('right', '$D');
$pdf->setDefaultPath(BASE_PATH.'/kernel/admin_templates/');
$result = $pdf->convert();
// Check if the result was an error
if (PEAR::isError($result)) {
$this->Application->ApplicationDie($result->getMessage());
}
else {
$download_url = rtrim($this->Application->BaseURL(), '/') . EXPORT_BASE_PATH . '/tmp.pdf';
echo "PDF file created successfully: $result";
echo '<br />Click <a href="' . $download_url . '">here</a> to view the PDF file.';
}
}
/**
* Occurs, when config was parsed, allows to change config data dynamically
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterConfigRead(kEvent $event)
{
parent::OnAfterConfigRead($event);
if (defined('IS_INSTALL') && IS_INSTALL) {
return ;
}
$order_number = (int)$this->Application->ConfigValue('Comm_Order_Number_Format_P');
$order_sub_number = (int)$this->Application->ConfigValue('Comm_Order_Number_Format_S');
$config = $event->getUnitConfig();
$calc_fields = $config->getSetting('CalculatedFields');
foreach ($calc_fields as $special => $fields) {
$calc_fields[$special]['OrderNumber'] = str_replace('6', $order_number, $calc_fields[$special]['OrderNumber']);
$calc_fields[$special]['OrderNumber'] = str_replace('3', $order_sub_number, $calc_fields[$special]['OrderNumber']);
}
$config->setSetting('CalculatedFields', $calc_fields);
$fields = $config->getFields();
$fields['Number']['format'] = str_replace('%06d', '%0'.$order_number.'d', $fields['Number']['format']);
$fields['SubNumber']['format'] = str_replace('%03d', '%0'.$order_sub_number.'d', $fields['SubNumber']['format']);
$site_helper = $this->Application->recallObject('SiteHelper');
/* @var $site_helper SiteHelper */
$fields['BillingCountry']['default'] = $site_helper->getDefaultCountry('Billing');
$fields['ShippingCountry']['default'] = $site_helper->getDefaultCountry('Shipping');
if (!$this->Application->isAdminUser) {
$user_groups = explode(',', $this->Application->RecallVar('UserGroups'));
$default_group = $this->Application->ConfigValue('User_LoggedInGroup');
if (!in_array($default_group, $user_groups)){
$user_groups[] = $default_group;
}
$sql_part = '';
// limit payment types by domain
$payment_types = $this->Application->siteDomainField('PaymentTypes');
if (strlen($payment_types)) {
$payment_types = explode('|', substr($payment_types, 1, -1));
$sql_part .= ' AND PaymentTypeId IN (' . implode(',', $payment_types) . ')';
}
// limit payment types by user group
$sql_part .= ' AND (PortalGroups LIKE "%%,'.implode(',%%" OR PortalGroups LIKE "%%,', $user_groups).',%%")';
$fields['PaymentType']['options_sql'] = str_replace(
'ORDER BY ',
$sql_part . ' ORDER BY ',
$fields['PaymentType']['options_sql']
);
}
$config->setFields($fields);
$user_default_form = $this->Application->getUnitConfig('u')->getFieldByName('default');
$virtual_fields = $config->getVirtualFields();
$virtual_fields['UserPassword']['hashing_method'] = $user_default_form['Fields']['PasswordHashingMethod']['default'];
$config->setVirtualFields($virtual_fields);
}
/**
* Allows configuring export options
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeExportBegin(kEvent $event)
{
parent::OnBeforeExportBegin($event);
$options = $event->getEventParam('options');
$items_list = $this->Application->recallObject($event->Prefix . '.' . $this->Application->RecallVar('export_oroginal_special'), $event->Prefix . '_List');
/* @var $items_list kDBList */
$items_list->SetPerPage(-1);
if ( $options['export_ids'] != '' ) {
$items_list->AddFilter('export_ids', $items_list->TableName . '.' . $items_list->IDField . ' IN (' . implode(',', $options['export_ids']) . ')');
}
$options['ForceCountSQL'] = $items_list->getCountSQL($items_list->GetSelectSQL(true, false));
$options['ForceSelectSQL'] = $items_list->GetSelectSQL();
$event->setEventParam('options', $options);
$object = $this->Application->recallObject($event->Prefix . '.export');
/* @var $object kDBItem */
$object->SetField('Number', 999999);
$object->SetField('SubNumber', 999);
}
/**
* Returns specific to each item type columns only
*
* @param kEvent $event
* @return Array
* @access protected
*/
public function getCustomExportColumns(kEvent $event)
{
$columns = parent::getCustomExportColumns($event);
$new_columns = Array (
'__VIRTUAL__CustomerName' => 'CustomerName',
'__VIRTUAL__TotalAmount' => 'TotalAmount',
'__VIRTUAL__AmountWithoutVAT' => 'AmountWithoutVAT',
'__VIRTUAL__SubtotalWithDiscount' => 'SubtotalWithDiscount',
'__VIRTUAL__SubtotalWithoutDiscount' => 'SubtotalWithoutDiscount',
'__VIRTUAL__OrderNumber' => 'OrderNumber',
);
return array_merge($columns, $new_columns);
}
/**
* Saves content of temp table into live and
* redirects to event' default redirect (normally grid template)
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnSave(kEvent $event)
{
parent::OnSave($event);
if ( $event->status != kEvent::erSUCCESS ) {
return ;
}
$copied_ids = unserialize($this->Application->RecallVar($event->Prefix . '_copied_ids' . $this->Application->GetVar('wid'), serialize(Array ())));
foreach ($copied_ids as $id) {
$an_event = new kEvent($this->Prefix . ':Dummy');
$this->Application->SetVar($this->Prefix . '_id', $id);
$this->Application->SetVar($this->Prefix . '_mode', ''); // this is to fool ReserveItems to use live table
$this->ReserveItems($an_event);
}
}
/**
* Occurs before an item is copied to live table (after all foreign keys have been updated)
* Id of item being copied is passed as event' 'id' param
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeCopyToLive(kEvent $event)
{
parent::OnBeforeCopyToLive($event);
$id = $event->getEventParam('id');
$copied_ids = unserialize($this->Application->RecallVar($event->Prefix . '_copied_ids' . $this->Application->GetVar('wid'), serialize(array ())));
array_push($copied_ids, $id);
$this->Application->StoreVar($event->Prefix . '_copied_ids' . $this->Application->GetVar('wid'), serialize($copied_ids));
}
/**
* Checks, that currently loaded item is allowed for viewing (non permission-based)
*
* @param kEvent $event
* @return bool
* @access protected
*/
protected function checkItemStatus(kEvent $event)
{
if ( $this->Application->isAdminUser ) {
return true;
}
$object = $event->getObject();
/* @var $object kDBItem */
if ( !$object->isLoaded() ) {
return true;
}
return $object->GetDBField('PortalUserId') == $this->Application->RecallVar('user_id');
}
// ===== Gift Certificates Related =====
/**
* Enter description here...
*
* @param kEvent $event
*/
function OnApplyGiftCertificate($event)
{
$code = $this->Application->GetVar('giftcert_code');
if ( $code == '' ) {
return;
}
$object = $event->getObject();
/* @var $object OrdersItem */
$gift_certificate = $this->Application->recallObject('gc', null, Array ('skip_autoload' => true));
/* @var $gift_certificate kDBItem */
$gift_certificate->Load($code, 'Code');
if ( !$gift_certificate->isLoaded() ) {
$event->status = kEvent::erFAIL;
$object->setCheckoutError(OrderCheckoutErrorType::GIFT_CERTIFICATE, OrderCheckoutError::GC_CODE_INVALID);
$event->redirect = false; // check!!!
return;
}
$debit = $gift_certificate->GetDBField('Debit');
$expire_date = $gift_certificate->GetDBField('Expiration');
if ( $gift_certificate->GetDBField('Status') != 1 || ($expire_date && $expire_date < adodb_mktime()) || ($debit <= 0) ) {
$event->status = kEvent::erFAIL;
$object->setCheckoutError(OrderCheckoutErrorType::GIFT_CERTIFICATE, OrderCheckoutError::GC_CODE_EXPIRED);
$event->redirect = false;
return;
}
$object->SetDBField('GiftCertificateId', $gift_certificate->GetDBField('GiftCertificateId'));
$object->Update();
$object->setCheckoutError(OrderCheckoutErrorType::GIFT_CERTIFICATE, OrderCheckoutError::GC_APPLIED);
}
/**
* Removes gift certificate from order
*
* @param kEvent $event
* @deprecated
*/
function OnRemoveGiftCertificate($event)
{
$object = $event->getObject();
/* @var $object OrdersItem */
$this->RemoveGiftCertificate($object);
$object->setCheckoutError(OrderCheckoutErrorType::GIFT_CERTIFICATE, OrderCheckoutError::GC_REMOVED);
$event->CallSubEvent('OnRecalculateItems');
}
function RemoveGiftCertificate(&$object)
{
$object->RemoveGiftCertificate();
}
function RecalculateGift($event)
{
$object = $event->getObject();
/* @var $object OrdersItem */
if ($object->GetDBField('Status') > ORDER_STATUS_PENDING) {
return ;
}
$object->RecalculateGift($event);
}
function GetWholeOrderGiftCertificateDiscount($gift_certificate_id)
{
if (!$gift_certificate_id) {
return 0;
}
$sql = 'SELECT Debit
FROM '.TABLE_PREFIX.'GiftCertificates
WHERE GiftCertificateId = '.$gift_certificate_id;
return $this->Conn->GetOne($sql);
}
/**
* Downloads shipping tracking bar code, that was already generated by USPS service
*
* @param kEvent $event
*/
function OnDownloadLabel($event)
{
$event->status = kEvent::erSTOP;
ini_set('memory_limit', '300M');
ini_set('max_execution_time', '0');
$object = $event->getObject();
/* @var $object kDBItem */
$file = $object->GetDBField('ShippingTracking') . '.pdf';
$full_path = USPS_LABEL_FOLDER . $file;
if ( !file_exists($full_path) || !is_file($full_path) ) {
return;
}
$this->Application->setContentType(kUtil::mimeContentType($full_path), false);
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile($full_path);
}
/**
* Occurs before validation attempt
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnBeforeItemValidate(kEvent $event)
{
parent::OnBeforeItemValidate($event);
$create_account = $this->Application->GetVar('create_account');
$object = $event->getObject();
/* @var $object kDBItem */
$required_fields = Array ('UserPassword', 'UserPassword_plain', 'VerifyUserPassword', 'VerifyUserPassword_plain');
$object->setRequired($required_fields, $create_account);
$billing_email = $object->GetDBField('BillingEmail');
if ( $create_account && $object->GetDBField('PortalUserId') == USER_GUEST && $billing_email ) {
// check that e-mail available
$sql = 'SELECT PortalUserId
FROM ' . TABLE_PREFIX . 'Users
WHERE Email = ' . $this->Conn->qstr($billing_email);
$user_id = $this->Conn->GetOne($sql);
if ( $user_id ) {
$object->SetError('BillingEmail', 'unique');
}
}
}
/**
* Performs order update and returns results in format, needed by FormManager
*
* @param kEvent $event
*/
function OnUpdateAjax($event)
{
$ajax_form_helper = $this->Application->recallObject('AjaxFormHelper');
/* @var $ajax_form_helper AjaxFormHelper */
$ajax_form_helper->transitEvent($event, 'OnUpdate');
}
}
\ No newline at end of file
Index: branches/5.3.x/units/products/products_tag_processor.php
===================================================================
--- branches/5.3.x/units/products/products_tag_processor.php (revision 15898)
+++ branches/5.3.x/units/products/products_tag_processor.php (revision 15899)
@@ -1,861 +1,861 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class ProductsTagProcessor extends kCatDBTagProcessor {
function Rating($params)
{
$object = $this->getObject($params);
$rating = round($object->GetDBField('CachedRating') );
$o = '';
for ($i = 0; $i < $rating; $i++) {
$o .= $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'star_on_render_as,block_star_on')) );
}
for ($i = 0; $i < 5 - $rating; $i++) {
$o .= $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'star_off_render_as,block_star_off')) );
}
return $o;
}
function NewMark($params)
{
$object = $this->getObject($params);
$o = '';
if($object->GetDBField('IsNew'))
{
$o .= $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'render_as,block')) );
}
return $o;
}
function HotMark($params)
{
$object = $this->getObject($params);
$o = '';
if($object->GetDBField('IsHot'))
{
$o .= $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'render_as,block')) );
}
return $o;
}
function TopSellerMark($params)
{
return $this->HotMark($params);
}
function PopMark($params)
{
$object = $this->getObject($params);
$o = '';
if($object->GetDBField('IsPop'))
{
$o .= $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'render_as,block')) );
}
return $o;
}
function EdPickMark($params)
{
$object = $this->getObject($params);
$o = '';
if($object->GetDBField('EditorsPick'))
{
$o .= $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'render_as,block')) );
}
return $o;
}
/**
* Parses block only if item is favorite
*
* @param Array $params
* @return string
* @deprecated used only in default,onlinestore
*/
function FavoriteMark($params)
{
if ($this->IsFavorite($params)) {
return $this->Application->ParseBlock( Array( 'name' => $this->SelectParam($params, 'render_as,block') ) );
}
return '';
}
function CurrentCategory($params)
{
$sql = "SELECT Name
FROM " . TABLE_PREFIX . "Categories
WHERE CategoryId=" . $this->Application->GetVar("m_cat_id");
return $this->Conn->GetOne($sql);
}
function RateForm($params)
{
$params['name'] = $this->SelectParam($params, 'render_as,block');
$labels = explode(',', $params['labels']);
$o = '';
$star_block = $this->SelectParam($params, 'star_render_as,star_block');
for($i = 5; $i >= 0; $i--)
{
$params['rating'] = $i;
$params['label'] = $this->Application->Phrase($labels[5 - $i]);
$params['stars'] = '';
for($j = $i; $j > 0; $j--)
{
$params['stars'] .= $this->Application->ParseBlock(Array('name' => $star_block));
}
$o .= $this->Application->ParseBlock($params);
}
return $o;
}
/**
* Parses block for changing favorite status
*
* @param Array $params
* @return string
* @deprecated used only in default,onlinestore
*/
function FavoriteToggle($params)
{
$block_params = Array ();
$block_names = $this->IsFavorite($params) ? 'remove_favorite_render_as,block_remove_favorite' : 'add_favorite_render_as,block_add_favorite';
$block_params['name'] = $this->SelectParam($params, $block_names);
$params['template'] = $params[$this->IsFavorite($params) ? 'template_on_remove' : 'template_on_add'];
$remove_params = Array (
'remove_favorite_render_as', 'block_remove_favorite', 'add_to_wish_list_render_as', 'block_add_to_wish_list',
'add_favorite_render_as', 'block_add_favorite', 'remove_from_wish_list_render_as', 'block_remove_from_wish_list',
'template_on_remove', 'template_on_add'
);
foreach ($params as $param_name => $param_value) {
if (in_array($param_name, $remove_params)) {
unset($params[$param_name]);
}
}
$block_params['wish_list_toggle_link'] = $this->FavoriteToggleLink($params);
return $this->Application->ParseBlock($block_params);
}
function WishListToggleLink($params)
{
$params['block_add_favorite'] = $this->SelectParam($params, 'add_to_wish_list_render_as,block_add_to_wish_list');
$params['block_remove_favorite'] = $this->SelectParam($params, 'remove_from_wish_list_render_as,block_remove_from_wish_list');
return $this->FavoriteToggle($params);
}
function AddReviewLink($params)
{
$o = $this->Application->ParseBlock( Array('name' => $this->SelectParam($params, 'render_as,block')) );
return $o;
}
function ListProducts($params)
{
return $this->PrintList2($params);
}
function ListRelatedProducts($params)
{
// $related = $this->Application->recallObject('rel');
return $this->PrintList2($params);
}
function BuildListSpecial($params)
{
if ($this->Special != '') return $this->Special;
if ( isset($params['parent_cat_id']) ) {
$parent_cat_id = $params['parent_cat_id'];
}
else {
$parent_cat_id = $this->Application->GetVar('c_id');
if (!$parent_cat_id) {
$parent_cat_id = $this->Application->GetVar('m_cat_id');
}
}
if ( isset($params['manufacturer']) ) {
$manufacturer = $params['manufacturer'];
}
else {
$manufacturer = $this->Application->GetVar('manuf_id');
}
$recursive = isset($params['recursive']);
$list_unique_key = $this->getUniqueListKey($params).$recursive;
if ($list_unique_key == '') {
return parent::BuildListSpecial($params);
}
return crc32($parent_cat_id.$list_unique_key.$manufacturer);
}
function ProductList($params)
{
if($params['shortlist'])
{
$params['per_page'] = $this->Application->ConfigValue('Comm_Perpage_Products_Short');
}
$object = $this->Application->recallObject( $this->getPrefixSpecial() , $this->Prefix.'_List', $params );
switch($params['ListType'])
{
case 'favorites':
return $this->PrintList($params);
break;
case 'search':
default:
if(isset($params['block']))
{
return $this->PrintList($params);
}
else
{
$params['block'] = $params['block_main'];
$params['row_start_block'] = $params['block_row_start'];
$params['row_end_block'] = $params['block_row_end'];
return $this->PrintList2($params);
}
}
}
/**
* Adds product to recently viewed list (only in case, when not already there)
*
* @param Array $params
*/
function AddToRecent($params)
{
$recent_products = $this->Application->RecallVar('recent_products');
if (!$recent_products) {
$recent_products = Array();
}
else {
$recent_products = unserialize($recent_products);
}
$product_id = $this->Application->GetVar('p_id');
if (!in_array($product_id, $recent_products)) {
array_push($recent_products, $product_id);
$this->Application->StoreVar('recent_products', serialize($recent_products));
}
}
function SearchMoreLink($params)
{
$object =& $this->GetList($params);
$o = '';
if($object->GetPerPage() < $this->SearchResultsCount())
{
$o = $this->Application->ParseBlock( Array('name' => $params['block']) );
}
return $o;
}
function AddToCartLink($params)
{
$object = $this->getObject($params);
if ($object->GetDBField('HasRequiredOptions')) {
$t = $params['product_template'];
if (!$t) {
$theme = $this->Application->recallObject('theme.current');
if ($theme->GetDBField('Name') == 'onlinestore') {
$t = 'in-commerce/product/details';
}
elseif ($theme->GetDBField('Name') == 'default') {
$t = 'in-commerce/product';
}
}
$link_params = Array('m_cat_id' => $object->GetDBField('CategoryId'), 'pass' => 'm,p');
}
else {
$t = $params['template'];
$link_params = Array('m_cat_id' => $object->GetDBField('CategoryId'), 'pass' => 'm,p,ord', 'ord_event' => 'OnAddToCart');
}
$this->Application->SetVar('p_id', $this->Application->GetVar($this->getPrefixSpecial().'_id'));
return $this->Application->HREF($t, '', $link_params);
}
function SearchResultsCount($params)
{
$search_results_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
$sql = ' SELECT COUNT(ResourceId)
FROM '.$search_results_table.'
WHERE ItemType=11';
return $this->Conn->GetOne($sql);
}
function DetailsLink($params)
{
$this->Application->SetVar( $this->Prefix.'_id', $this->Application->GetVar($this->getPrefixSpecial().'_id') );
$ret = $this->Application->HREF('in-commerce/details', '', Array('pass' => 'all,p'));
return $ret;
}
function ProductLink($params)
{
return $this->ItemLink($params, 'product');
}
function ProductFileLink($params)
{
// 'p_id'=>'0', ??
$params = array_merge($params, Array('pass'=>'all,m,p,file.downl'));
$product_id = getArrayValue($params,'product_id');
if (!$product_id) {
$product_id = $this->Application->GetVar($this->Prefix.'_id');
}
$params['p_id'] = $product_id;
$product = $this->Application->recallObject($this->getPrefixSpecial());
$params['m_cat_id'] = $product->GetDBField('CategoryId');
$main_processor = $this->Application->recallObject('m_TagProcessor');
return $main_processor->T($params);
}
function GetMarkedVal($params)
{
$list =& $this->GetList($params);
return $this->Application->RecallVar($list->getPrefixSpecial().$params['name']);
}
function SortingOptions($params)
{
$list =& $this->GetList($params);
$sorting_field_selected = $this->Application->RecallVar($list->getPrefixSpecial() . $params['sorting_select_name']);
if ( !$sorting_field_selected ) {
$sorting_field_selected = $this->Application->ConfigValue('product_OrderProductsBy');
}
$sql = 'SELECT ValueList
FROM ' . TABLE_PREFIX . 'SystemSettings
WHERE VariableName = "product_OrderProductsBy"';
$field_list_plain = $this->Conn->GetOne($sql);
$field_list = explode(',', $field_list_plain);
$o = '';
$option_params = $this->prepareTagParams($params);
foreach ($field_list as $field) {
list($fieldname, $fieldlabel) = explode('=', $field);
$option_params['fieldname'] = $fieldname;
$option_params['fieldlabel'] = $this->Application->Phrase($fieldlabel);
$option_params['name'] = $params['block_options'];
$option_params['selected'] = $fieldname == $sorting_field_selected ? 'selected' : '';
$o .= $this->Application->ParseBlock($option_params);
}
return $o;
}
function SortingDirectionOptions($params)
{
$list =& $this->GetList($params);
$sorting_dir_selected = $this->Application->RecallVar($list->getPrefixSpecial() . $params['sorting_select_name']);
if ( !$sorting_dir_selected ) {
$sorting_dir_selected = $this->Application->ConfigValue('product_OrderProductsByDir');
}
$o = '';
$field_list = array ('asc' => 'lu_Ascending', 'desc' => 'lu_Descending');
$option_params = $this->prepareTagParams($params);
foreach ($field_list as $fieldname => $fieldlabel) {
$option_params['fieldname'] = $fieldname;
$option_params['fieldlabel'] = $this->Application->Phrase($fieldlabel);
$option_params['name'] = $params['block_options'];
$option_params['selected'] = $fieldname == $sorting_dir_selected ? 'selected' : '';
$o .= $this->Application->ParseBlock($option_params);
}
return $o;
}
function ErrorMessage($params)
{
if( $this->Application->GetVar('keywords_too_short') )
{
$ret = $this->Application->ParseBlock(Array('name' => $this->SelectParam($params, 'keywords_too_short_render_as,block_keywords_too_short')));
}
elseif( $this->Application->GetVar('adv_search_error') )
{
$ret = $this->Application->ParseBlock(Array('name' => $this->SelectParam($params, 'adv_search_error_render_as,block_adv_search_error')));
}
else
{
$ret = $this->Application->ParseBlock(Array('name' => $this->SelectParam($params, 'no_found_render_as,block_no_found')));
}
return $ret;
}
function ListReviews($params)
{
$review_tag_processor = $this->Application->recallObject('rev.product_TagProcessor');
return $review_tag_processor->PrintList($params);
}
function ReviewCount($params)
{
$review_tag_processor = $this->Application->recallObject('rev.product_TagProcessor');
return $review_tag_processor->TotalRecords($params);
}
function InitList($params){
$passed_manuf_id = $this->Application->GetVar('manuf_id');
if ($passed_manuf_id && !isset($params['manufacturer'])){
$params['manufacturer'] = $passed_manuf_id;
}
parent::InitList($params);
}
/**
* Builds link to manufacturer page
*
* @param Array $params
* @return string
*/
function ManufacturerLink($params)
{
if ( array_key_exists('manufacturer_id', $params) ) {
// use direct manufacturer from tag
$params['manuf_id'] = $params['manufacturer_id'];
unset($params['manufacturer_id']);
}
else {
// use product's manufacturer
$object = $this->getObject($params);
$item_manufacturer_id = $object->GetDBField('ManufacturerId');
if ($item_manufacturer_id){
$params['manuf_id'] = $item_manufacturer_id;
}
}
$params['pass'] = 'm,manuf';
$params['m_cat_id'] = 0;
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
function AlreadyReviewed($params)
{
$rev_tag_processor = $this->Application->recallObject('rev_TagProcessor');
return $rev_tag_processor->AlreadyReviewed($params);
}
function PrepareSearchResults($params)
{
$names_mapping = $this->Application->GetVar('NamesToSpecialMapping', Array ());
if($this->Application->GetVar('search_type') == 'advanced' || !getArrayValue($names_mapping, $this->Prefix, 'search_results'))
{
$params = Array('list_name' => 'search_results',
'types' => 'search',
'parent_cat_id' => 'any',
'recursive' => 'true',
'per_page' => 'short_list'
);
$this->InitList($params);
}
return '';
}
function Available($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
if ( !$object->GetDBField('InventoryStatus') ) {
return true;
}
$backordering = $this->Application->ConfigValue('Comm_Enable_Backordering');
if ( $object->GetDBField('InventoryStatus') == 2 ) {
$poc_table = $this->Application->getUnitConfig('poc')->getTableName();
$sql = 'SELECT SUM(IF(QtyInStock > ' . $object->GetDBField('QtyInStockMin') . ', 1, 0))
FROM ' . $poc_table . '
WHERE (ProductId = ' . $object->GetID() . ') AND (Availability = 1)';
$stock_available = $this->Conn->GetOne($sql) > 0; // at least one option combination present
}
else {
$stock_available = $object->GetDBField('QtyInStock') > $object->GetDBField('QtyInStockMin');
}
$prod_backordering = $object->GetDBField('BackOrder');
if ( $stock_available ) {
return true;
}
// stock is NOT available:
if ( !$backordering || $prod_backordering == 0 ) {
// if backordering is generaly disabled or disabled for product (Never)
return false;
}
// backordering enabled; (auto or always mode)
return true;
}
function IsSubscription($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
return ($object->GetDBField('Type') == 2);
}
function IsTangible($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
return ($object->GetDBField('Type') == 1);
}
function HasFiles($params)
{
$sql = 'SELECT COUNT(FileId)
FROM '.$this->Application->getUnitConfig('file')->getTableName().'
WHERE ProductId = '.$this->Application->GetVar('p_id').' AND Status = 1';
return $this->Conn->GetOne($sql) ? 1 : 0;
}
function UniqueFileName($params)
{
$file_object = $this->Application->recallObject('file.downl');
return ($file_object->GetDBField('Name') &&
$file_object->GetDBField('Name') != $file_object->GetDBField('FilePath'))
? 1 : 0;
}
function FileDownload($params)
{
$file_id = $this->Application->GetVar('file.downl_id');
$product_id = $file_id ? $this->Conn->GetOne('SELECT ProductId
FROM '.$this->Application->getUnitConfig('file')->getTableName().'
WHERE FileId = '.$file_id) :
$this->Application->GetVar($this->getPrefixSpecial().'_id');
$download_helper_class = $this->getUnitConfig()->getDownloadHelperClass('DownloadHelper');
$download_helper = $this->Application->recallObject($download_helper_class);
if (!$download_helper->CheckAccess($file_id, $product_id)) {
$this->Application->ApplicationDie('File Access permission check failed!');
}
$file_info = $download_helper->SendFile($file_id, $product_id);
$download_helper->LogDownload($product_id, $file_info);
define('DBG_SKIP_REPORTING', 1);
$this->Application->ApplicationDie();
}
function PictureLink($params)
{
if (getArrayValue($params, 'picture_list')) {
$params['img_id'] = $this->Application->GetVar('img_id');
$params['pass'] = 'all,p,img';
unset($params['picture_list']);
}
else {
$params['pass'] = 'all,p';
}
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
function ShouldListOptions($params)
{
$object = $this->getObject($params);
$req_filter = '';
if (getArrayValue($params, 'required_only')) {
$req_filter = ' AND Required = 1';
}
$query = 'SELECT COUNT(*) FROM '.TABLE_PREFIX.'ProductOptions WHERE ProductId = '.$object->GetID().$req_filter;
$res = $this->Conn->GetOne($query);
return $res > 0;
}
function CountOptions($params)
{
$object = $this->getObject($params);
$query = 'SELECT COUNT(*) FROM '.TABLE_PREFIX.'ProductOptions WHERE ProductId = '.$object->GetID();
$res = $this->Conn->GetOne($query);
$max = $this->SelectParam($params, 'greater');
if (!$max) $max = 0;
return $res > $max;
}
function OptionsUpdateMode($params)
{
return $this->Application->GetVar('orditems_id') !== false;
}
function OptionsHaveError($params)
{
return $this->Application->GetVar('opt_error') > 0;
}
function OptionsError($params)
{
switch ($this->Application->GetVar('opt_error')) {
case 1:
return $this->Application->Phrase($params['required']);
case 2:
return $this->Application->Phrase($params['not_available']);
}
}
function ListShippingTypes($params)
{
$quote_engine_collector = $this->Application->recallObject('ShippingQuoteCollector');
/* @var $quote_engine_collector ShippingQuoteCollector */
$types = $quote_engine_collector->GetAvailableShippingTypes();
$object = $this->getObject($params);
$selected = $object->GetDBField('ShippingLimitation');
$selected = explode('|', substr($selected, 1, -1));
$o = '';
foreach ($types as $a_type)
{
$is_selected = in_array($a_type['_Id'], $selected);
$continue = $params['mode'] == 'selected' ? !$is_selected : $is_selected;
if ($continue) continue;
$block_params = $a_type;
$block_params['name'] = $params['render_as'];
$o .= $this->Application->ParseBlock($block_params);
}
return $o;
}
function PageLink($params)
{
$manufacturer_id = $this->Application->GetVar('manuf_id');
if ($manufacturer_id) {
$params['pass'] = 'm,'.$this->getPrefixSpecial().',manuf';
}
return parent::PageLink($params);
}
/**
* Calculate savings based on price & market price relationship
*
* @param Array $params
* @return int
*/
function Savings($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$price = $object->GetDBField('Price');
$msrp = $object->GetDBField('MSRP');
$value = 0;
if (isset($params['type']) && ($params['type'] == 'percent')) {
if ($msrp > 0) {
return 100 - round($price * 100 / $msrp);
}
}
else {
if ($msrp > $price) {
$value = $msrp - $price;
}
}
if (isset($params['currency'])) {
$lang = $this->Application->recallObject('lang.current');
/* @var $lang LanguagesItem */
$iso = $this->GetISO($params['currency']);
$value = $this->ConvertCurrency($value, $iso);
$value = $lang->formatNumber( sprintf('%.2f', $value) );
$value = $this->AddCurrencySymbol($value, $iso);
}
return $value;
}
/**
* Hides permission tab, when it's not allowed by configuration settings
*
* @param Array $params
*/
function ModifyUnitConfig($params)
{
$config = $this->getUnitConfig();
$edit_tab_preset = $config->getEditTabPresetByName('Default');
$object = $this->getObject($params);
/* @var $object kDBItem */
$product_type = $object->GetDBField('Type');
if ($product_type != PRODUCT_TYPE_TANGIBLE) {
unset($edit_tab_preset['inventory']);
}
if ($product_type == PRODUCT_TYPE_SUBSCRIPTION) {
unset($edit_tab_preset['options']);
}
else {
unset($edit_tab_preset['access_and_pricing']);
}
if ($product_type != PRODUCT_TYPE_TANGIBLE && $product_type != PRODUCT_TYPE_PACKAGE) {
unset($edit_tab_preset['pricing']);
}
else {
unset($edit_tab_preset['pricing2']);
}
if ($product_type != PRODUCT_TYPE_DOWNLOADABLE) {
unset($edit_tab_preset['files_and_pricing']);
}
if ($product_type != PRODUCT_TYPE_PACKAGE) {
unset($edit_tab_preset['package_content']);
}
$config->addEditTabPresets($edit_tab_preset, 'Default');
}
/**
* Checks, that current product is in compare products list
*
* @param Array $params
* @return string
* @access protected
*/
protected function InCompare($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$products = $this->Application->GetVarDirect('compare_products', 'Cookie');
$products = $products ? explode('|', $products) : Array ();
return in_array($object->GetID(), $products);
}
/**
* Checks, that one more product can be added to comparison list
*
* @param Array $params
* @return string
* @access protected
*/
protected function ComparePossible($params)
{
$products = $this->Application->GetVarDirect('compare_products', 'Cookie');
$products = $products ? explode('|', $products) : Array ();
return count($products) < $this->Application->ConfigValue('MaxCompareProducts');
}
/**
* Checks if given field is filled for at least one product in comparison page
*
* @param Array $params
* @return string
* @access protected
*/
protected function HasCompareField($params)
{
$object =& $this->GetList($params);
$object->GoFirst();
$field = $this->SelectParam($params, 'name,field');
while ( !$object->EOL() ) {
if ( $object->GetField($field) ) {
// don't use GetCol, since it fails to process ML fields
return true;
}
$object->GoNext();
}
return false;
}
/**
* Builds link to product compare page
*
* @param Array $params
* @return string
* @access protected
*/
protected function CompareLink($params)
{
- $params['continue'] = urlencode($this->Application->HREF('__default__', '', Array ('pass_category' => 1)));
+ $params['continue'] = kUtil::escape($this->Application->HREF('__default__', '', Array ('pass_category' => 1)), kUtil::ESCAPE_URL);
return $this->Application->ProcessParsedTag('m', 'Link', $params);
}
/**
* Builds link to continue website browsing from compare products page
*
* @param Array $params
* @return string
* @access protected
*/
protected function ContinueLink($params)
{
$url = $this->Application->GetVar('continue');
if ( isset($params['redirect']) && $params['redirect'] ) {
$this->Application->Redirect('external:' . $url);
}
return $url;
}
}
\ No newline at end of file
Index: branches/5.3.x/units/products/products_config.php
===================================================================
--- branches/5.3.x/units/products/products_config.php (revision 15898)
+++ branches/5.3.x/units/products/products_config.php (revision 15899)
@@ -1,713 +1,701 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'p',
'ItemClass' => Array ('class' => 'ProductsItem', 'file' => 'products_item.php', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kCatDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'ProductsEventHandler', 'file' => 'products_event_handler.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'ProductsTagProcessor', 'file' => 'products_tag_processor.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
5 => 'mode',
),
'CatalogItem' => true,
'AdminTemplatePath' => 'products',
'AdminTemplatePrefix' => 'products_',
'SearchConfigPostfix' => 'products',
'ConfigPriority' => 0,
'RewritePriority' => 104,
'RewriteListener' => 'CategoryItemRewrite:RewriteListener',
'Hooks' => Array (
- // for subscription products: access group is saved before changing pricings
- Array (
- 'Mode' => hAFTER,
- 'Conditional' => true,
- 'HookToPrefix' => 'pr',
- 'HookToSpecial' => '*',
- 'HookToEvent' => Array ('OnNew', 'OnAfterItemLoad'),
- 'DoPrefix' => '',
- 'DoSpecial' => '*',
- 'DoEvent' => 'OnPreSave',
- ),
-
Array (
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'lst',
'HookToSpecial' => '',
'HookToEvent' => Array ( 'OnBeforeCopyToLive' ),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnSaveVirtualProduct',
),
Array (
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'lst',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterItemDelete'),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnDeleteListingType',
),
Array (
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'lst',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnModifyPaidListingConfig',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'file',
'HookToSpecial' => '',
'HookToEvent' => Array ( 'OnNew', 'OnEdit' ),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnPreSave',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => '',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => 'cdata',
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'rev',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'fav',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => 'ci',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
),
'IDField' => 'ProductId',
'StatusField' => Array ('Status'), // field, that is affected by Approve/Decline events
'TitleField' => 'Name', // field, used in bluebar when editing existing item
'ItemType' => 11, // this is used when relation to product is added from in-portal and via-versa
'ViewMenuPhrase' => 'la_text_Products',
'CatalogTabIcon' => 'in-commerce:icon16_products.png',
'ItemPropertyMappings' => Array (
'NewDays' => 'Product_NewDays', // number of days item to be NEW
'MinPopVotes' => 'Product_MinPopVotes', // minimum number of votes for an item to be POP
'MinPopRating' => 'Product_MinPopRating', // minimum rating for an item to be POP
'MaxHotNumber' => 'Product_MaxHotNumber', // maximum number of HOT (top seller) items
'HotLimit' => 'Product_HotLimit', // variable name in inp_Cache table
'ClickField' => 'Hits', // item click count is stored here (in item table)
),
'TitlePhrase' => 'la_text_Product',
'TitlePresets' => Array (
'default' => Array (
'new_status_labels' => Array ('p' => '!la_title_Adding_Product!'),
'edit_status_labels' => Array ('p' => '!la_title_Editing_Product!'),
'new_titlefield' => Array ('p' => '!la_title_NewProduct!'),
),
'product_list' =>Array (
'prefixes' => Array ('c_List', 'p_List'),
'tag_params' => Array ('c' => Array ('per_page' =>-1)),
'format' => "!la_title_Categories! (#c_recordcount#) - !la_title_Products! (#p_recordcount#)",
),
'products_edit' =>Array (
'prefixes' => Array ('p'),
'new_titlefield' => Array ('p' => '!la_title_NewProduct!'),
'format' => "#p_status# '#p_titlefield#' - !la_title_General!",
),
'inventory' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# - '#p_titlefield#' - !la_title_Product_Inventory!"),
'pricing' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Product_Pricing!"),
'access_pricing' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Product_AccessPricing!"),
'access' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Product_Access!"),
'files' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Product_Files!"),
'options' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Product_Options!"),
'categories' => Array ('prefixes' => Array ('p', 'p-ci_List'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Categories!"),
'relations' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Relations!"),
'content' => Array ('prefixes' => Array ('p', 'p.content_List'), 'tag_params' => Array ('p.content' => Array ('types' => 'content', 'live_table' =>true)), 'format' => "#p_status# '#p_titlefield#' - !la_title_Product_PackageContent!"),
'images' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Images!"),
'reviews' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Reviews!"),
'products_custom' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_Custom!"),
'images_edit' => Array (
'prefixes' => Array ('p', 'img'),
'new_status_labels' => Array ('img' => '!la_title_Adding_Image!'),
'edit_status_labels' => Array ('img' => '!la_title_Editing_Image!'),
'new_titlefield' => Array ('img' => '!la_title_New_Image!'),
'format' => "#p_status# '#p_titlefield#' - #img_status# '#img_titlefield#'",
),
'pricing_edit' => Array (
'prefixes' => Array ('p', 'pr'),
'new_status_labels' => Array ('pr' =>"!la_title_Adding_PriceBracket! '!la_title_New_PriceBracket!'"),
'edit_status_labels' => Array ('pr' => '!la_title_Editing_PriceBracket!'),
'format' => "#p_status# '#p_titlefield#' - #pr_status#",
),
'options_edit' => Array (
'prefixes' => Array ('p', 'po'),
'new_status_labels' => Array ('po' =>"!la_title_Adding_Option!"),
'edit_status_labels' => Array ('po' => '!la_title_Editing_Option!'),
'new_titlefield' => Array ('po' => '!la_title_New_Option!'),
'format' => "#p_status# '#p_titlefield#' - #po_status# '#po_titlefield#'",
),
'options_combinations' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_ManagingOptionCombinations!"),
'shipping_options' => Array ('prefixes' => Array ('p'), 'format' => "#p_status# '#p_titlefield#' - !la_title_ManagingShippingOptions!"),
'file_edit' => Array (
'prefixes' => Array ('p', 'file'),
'new_status_labels' => Array ('file' =>"!la_title_Adding_File!"),
'edit_status_labels' => Array ('file' => '!la_title_Editing_File!'),
'new_titlefield' => Array ('file' => '!la_title_New_File!'),
'format' => "#p_status# '#p_titlefield#' - #file_status# '#file_titlefield#'",
),
'relations_edit' => Array (
'prefixes' => Array ('p', 'rel'),
'new_status_labels' => Array ('rel' =>"!la_title_Adding_Relationship! '!la_title_New_Relationship!'"),
'edit_status_labels' => Array ('rel' => '!la_title_Editing_Relationship!'),
'format' => "#p_status# '#p_titlefield#' - #rel_status#",
),
'reviews_edit' => Array (
'prefixes' => Array ('p', 'rev'),
'new_status_labels' => Array ('rev' =>"!la_title_Adding_Review! '!la_title_New_Review!'"),
'edit_status_labels' => Array ('rev' => '!la_title_Editing_Review!'),
'format' => "#p_status# '#p_titlefield#' - #rev_status#",
),
'products_export' => Array ('format' => '!la_title_ProductsExport!'),
'products_import' => Array ('format' => '!la_title_ImportProducts!'),
'tree_in-commerce' => Array ('format' => '!la_Text_Version! '.$this->Application->findModule('Name', 'In-Commerce', 'Version')),
),
'EditTabPresets' => Array (
'Default' => Array (
'general' => Array ('title' => 'la_tab_General', 't' => 'in-commerce/products/products_edit', 'priority' => 1),
'inventory' => Array ('title' => 'la_tab_Inventory', 't' => 'in-commerce/products/products_inventory', 'priority' => 2),
'access_and_pricing' => Array ('title' => 'la_tab_AccessAndPricing', 't' => 'in-commerce/products/products_access', 'priority' => 3),
'pricing' => Array ('title' => 'la_tab_Pricing', 't' => 'in-commerce/products/products_pricing', 'priority' => 4),
// 'pricing2' => Array ('title' => 'la_tab_Pricing', 't' => 'in-commerce/products/products_access_pricing', 'priority' => 5),
'files_and_pricing' => Array ('title' => 'la_tab_FilesAndPricing', 't' => 'in-commerce/products/products_files', 'priority' => 6),
'options' => Array ('title' => 'la_tab_Options', 't' => 'in-commerce/products/products_options', 'priority' => 7),
'categories' => Array ('title' => 'la_tab_Categories', 't' => 'in-commerce/products/products_categories', 'priority' => 8),
'relations' => Array ('title' => 'la_tab_Relations', 't' => 'in-commerce/products/products_relations', 'priority' => 9),
'package_content' => Array ('title' => 'la_tab_PackageContent', 't' => 'in-commerce/products/products_packagecontent', 'priority' => 10),
'images' => Array ('title' => 'la_tab_Images', 't' => 'in-commerce/products/products_images', 'priority' => 11),
'reviews' => Array ('title' => 'la_tab_Reviews', 't' => 'in-commerce/products/products_reviews', 'priority' => 12),
'custom' => Array ('title' => 'la_tab_Custom', 't' => 'in-commerce/products/products_custom', 'priority' => 13),
),
),
'PermItemPrefix' => 'PRODUCT',
'PermTabText' => 'In-Commerce',
'PermSection' => Array ('main' => 'CATEGORY:in-commerce:products_list', 'search' => 'in-commerce:search', 'custom' => 'in-commerce:configuration_custom'),
'Sections' => Array (
'in-commerce' => Array (
'parent' => 'in-portal:root',
'icon' => 'ecommerce',
'label' => 'la_title_In-Commerce',
'url' => Array ('t' => 'index', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view'),
'priority' => 2.1,
'container' => true,
'type' => stTREE,
),
'in-commerce:products' => Array (
'parent' => 'in-portal:site',
'icon' => 'products',
'label' => 'la_tab_Products',
'url' => Array ('t' => 'catalog/advanced_view', 'anchor' => 'tab-p.showall', 'pass' => 'm'),
'onclick' => 'setCatalogTab(\'p.showall\')',
'permissions' => Array ('view'),
'priority' => 3.2,
'type' => stTREE,
),
// product settings
'in-commerce:setting_folder' => Array (
'parent' => 'in-portal:system',
'icon' => 'conf_ecommerce',
'label' => 'la_title_In-Commerce',
'use_parent_header' => 1,
'url' => Array ('t' => 'index', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view'),
'priority' => 3.1,
'container' => true,
'type' => stTREE,
),
'in-commerce:general' => Array (
'parent' => 'in-commerce:setting_folder',
'icon' => 'conf_ecommerce_general',
'label' => 'la_tab_GeneralSettings',
'url' => Array ('t' => 'config/config_general', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'add', 'edit'),
'priority' => 1,
'type' => stTREE,
),
'in-commerce:output' => Array (
'parent' => 'in-commerce:setting_folder',
'icon' => 'core:conf_output',
'label' => 'la_tab_ConfigOutput',
'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'add', 'edit'),
'priority' => 2,
'type' => stTREE,
),
'in-commerce:search' => Array (
'parent' => 'in-commerce:setting_folder',
'icon' => 'core:conf_search',
'label' => 'la_tab_ConfigSearch',
'url' => Array ('t' => 'config/config_search', 'module_key' => 'products', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'edit'),
'priority' => 7,
'type' => stTREE,
),
'in-commerce:configuration_custom' => Array (
'parent' => 'in-commerce:setting_folder',
'icon' => 'core:conf_customfields',
'label' => 'la_tab_ConfigCustom',
'url' => Array ('t' => 'custom_fields/custom_fields_list', 'cf_type' => 11, 'pass_section' => true, 'pass' => 'm,cf'),
'permissions' => Array ('view', 'add', 'edit', 'delete'),
'priority' => 8,
'type' => stTREE,
),
'in-commerce:contacts' => Array (
'parent' => 'in-commerce:setting_folder',
'icon' => 'conf_contact_info',
'label' => 'la_tab_ConfigContacts',
'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
'permissions' => Array ('view', 'add', 'edit'),
'priority' => 10,
'type' => stTREE,
),
),
'FilterMenu' => Array (
'Groups' => Array (
Array ('mode' => 'AND', 'filters' => Array ('show_new'), 'type' => kDBList::HAVING_FILTER),
Array ('mode' => 'AND', 'filters' => Array ('show_hot'), 'type' => kDBList::HAVING_FILTER),
Array ('mode' => 'AND', 'filters' => Array ('show_pop'), 'type' => kDBList::HAVING_FILTER),
Array ('mode' => 'AND', 'filters' => Array ('show_pick'), 'type' => kDBList::WHERE_FILTER),
),
'Filters' => Array (
'show_new' => Array ('label' => 'la_Text_New', 'on_sql' => '', 'off_sql' => '`IsNew` != 1' ),
'show_hot' => Array ('label' => 'la_Text_TopSellers', 'on_sql' => '', 'off_sql' => '`IsHot` != 1' ),
'show_pop' => Array ('label' => 'la_Text_Pop', 'on_sql' => '', 'off_sql' => '`IsPop` != 1' ),
'show_pick' => Array ('label' => 'la_prompt_EditorsPick', 'on_sql' => '', 'off_sql' => '%1$s.`EditorsPick` != 1' ),
)
),
'TableName' => TABLE_PREFIX . 'Products',
'CustomDataTableName' => TABLE_PREFIX . 'ProductsCustomData',
'CalculatedFields' => Array (
'' => Array (
'AltName' => 'img.AltName',
'SameImages' => 'img.SameImages',
'LocalThumb' => 'img.LocalThumb',
'ThumbPath' => 'img.ThumbPath',
'ThumbUrl' => 'img.ThumbUrl',
'LocalImage' => 'img.LocalImage',
'LocalPath' => 'img.LocalPath',
'FullUrl' => 'img.Url',
'Price' => 'COALESCE(pricing.Price, 0)',
'Cost' => 'COALESCE(pricing.Cost, 0)',
'PrimaryCat' => TABLE_PREFIX.'%3$sCategoryItems.PrimaryCat',
'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId',
'ParentPath' => TABLE_PREFIX.'Categories.ParentPath',
'Manufacturer' => TABLE_PREFIX.'Manufacturers.Name',
'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename',
'CategoryFilename' => TABLE_PREFIX.'Categories.NamedParentPath',
'FileSize' => 'files.Size',
'FilePath' => 'files.FilePath',
'FileVersion' => 'files.Version',
),
'showall' => Array (
'Price' => 'COALESCE(pricing.Price, 0)',
'Manufacturer' => TABLE_PREFIX.'Manufacturers.Name',
'PrimaryCat' => TABLE_PREFIX.'%3$sCategoryItems.PrimaryCat',
'CategoryId' => TABLE_PREFIX.'%3$sCategoryItems.CategoryId',
'FileSize' => 'files.Size',
'FilePath' => 'files.FilePath',
'FileVersion' => 'files.Version',
'Filename' => TABLE_PREFIX.'%3$sCategoryItems.Filename',
'CategoryFilename' => TABLE_PREFIX.'Categories.NamedParentPath',
),
),
'CacheModRewrite' => true,
'ListSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'UserGroups ON '.TABLE_PREFIX.'UserGroups.GroupId = %1$s.AccessGroupId
LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryItems ON '.TABLE_PREFIX.'%3$sCategoryItems.ItemResourceId = %1$s.ResourceId
+ {PERM_JOIN}
LEFT JOIN '.TABLE_PREFIX.'Categories ON '.TABLE_PREFIX.'Categories.CategoryId = '.TABLE_PREFIX.'%3$sCategoryItems.CategoryId
LEFT JOIN '.TABLE_PREFIX.'%3$sCatalogImages img ON img.ResourceId = %1$s.ResourceId AND img.DefaultImg = 1
LEFT JOIN '.TABLE_PREFIX.'%3$sProductFiles files ON files.ProductId = %1$s.ProductId AND files.IsPrimary = 1
LEFT JOIN '.TABLE_PREFIX.'%3$sProductsPricing pricing ON pricing.ProductId = %1$s.ProductId AND pricing.IsPrimary = 1
LEFT JOIN '.TABLE_PREFIX.'Manufacturers ON '.TABLE_PREFIX.'Manufacturers.ManufacturerId = %1$s.ManufacturerId
- LEFT JOIN '.TABLE_PREFIX.'CategoryPermissionsCache perm ON perm.CategoryId = '.TABLE_PREFIX.'%3$sCategoryItems.CategoryId
LEFT JOIN '.TABLE_PREFIX.'%3$sProductsCustomData cust ON %1$s.ResourceId = cust.ResourceId',
'showall' => 'SELECT %1$s.* %2$s FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'%3$sProductsPricing pricing ON pricing.ProductId = %1$s.ProductId AND pricing.IsPrimary = 1
LEFT JOIN '.TABLE_PREFIX.'%3$sProductFiles files ON files.ProductId = %1$s.ProductId AND files.IsPrimary = 1
LEFT JOIN '.TABLE_PREFIX.'Manufacturers ON '.TABLE_PREFIX.'Manufacturers.ManufacturerId = %1$s.ManufacturerId
LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryItems ON '.TABLE_PREFIX.'%3$sCategoryItems.ItemResourceId = %1$s.ResourceId
+ {PERM_JOIN}
LEFT JOIN '.TABLE_PREFIX.'Categories ON '.TABLE_PREFIX.'Categories.CategoryId = '.TABLE_PREFIX.'%3$sCategoryItems.CategoryId
- LEFT JOIN '.TABLE_PREFIX.'CategoryPermissionsCache perm ON perm.CategoryId = '.TABLE_PREFIX.'%3$sCategoryItems.CategoryId
LEFT JOIN '.TABLE_PREFIX.'%3$sProductsCustomData cust ON %1$s.ResourceId = cust.ResourceId',
),
'ListSortings' => Array (
'' => Array (
'ForcedSorting' => Array ('EditorsPick' => 'desc', 'Priority' => 'desc'),
'Sorting' => Array ('Name' => 'asc'),
)
),
'ItemSQLs' => Array (
'' => ' SELECT %1$s.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'UserGroups pg ON pg.GroupId = %1$s.AccessGroupId
LEFT JOIN '.TABLE_PREFIX.'%3$sCategoryItems ON '.TABLE_PREFIX.'%3$sCategoryItems.ItemResourceId = %1$s.ResourceId
LEFT JOIN '.TABLE_PREFIX.'Categories ON '.TABLE_PREFIX.'Categories.CategoryId = '.TABLE_PREFIX.'%3$sCategoryItems.CategoryId
LEFT JOIN '.TABLE_PREFIX.'%3$sCatalogImages img ON img.ResourceId = %1$s.ResourceId AND img.DefaultImg = 1
LEFT JOIN '.TABLE_PREFIX.'%3$sProductFiles files ON files.ProductId = %1$s.ProductId AND files.IsPrimary = 1
LEFT JOIN '.TABLE_PREFIX.'%3$sProductsPricing pricing ON pricing.ProductId = %1$s.ProductId AND pricing.IsPrimary = 1
LEFT JOIN '.TABLE_PREFIX.'Manufacturers ON '.TABLE_PREFIX.'Manufacturers.ManufacturerId = %1$s.ManufacturerId
LEFT JOIN '.TABLE_PREFIX.'%3$sProductsCustomData cust ON %1$s.ResourceId = cust.ResourceId',
),
'SubItems' => Array ('pr', 'rev', 'img', 'po', 'poc', 'p-ci', 'rel', 'file', 'p-cdata', 'p-fav'),
'Fields' => Array (
'ProductId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0,),
'Name' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'required' => 1, 'max_len' =>255, 'default' => ''),
'AutomaticFilename' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
),
'SKU' => Array ('type' => 'string', 'required' => 1, 'max_len' =>255, 'error_msgs' => Array ('required' => 'Please fill in'), 'default' => NULL),
'Description' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'using_fck' => 1, 'default' => NULL),
'DescriptionExcerpt' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'using_fck' => 1, 'default' => NULL),
'Weight' => Array ('type' => 'float', 'min_value_exc' => 0, 'formatter' => 'kUnitFormatter', 'format' => '%0.2f', 'default' => NULL),
'MSRP' => Array ('type' => 'float', 'min_value_inc' => 0, 'formatter' => 'kFormatter', 'format' => '%0.2f', 'default' => NULL),
'ManufacturerId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Manufacturers ORDER BY Name', 'option_key_field' => 'ManufacturerId', 'option_title_field' => 'Name', 'not_null' => 1, 'default' => 0),
'Status' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled'), 'use_phrases' => 1,
'default' => 2, 'not_null' => 1,
),
'BackOrder' => Array ('type' => 'int', 'not_null' => 1, 'options' => Array ( 2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never' ), 'use_phrases' => 1, 'default' => 2 ),
'BackOrderDate' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'error_msgs' => Array ('bad_date_format' => 'Please use the following date format: %s'), 'default' => NULL),
'NewItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array ( 2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never' ), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2 ),
'HotItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array ( 2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never' ), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2 ),
'PopItem' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array ( 2 => 'la_Auto', 1 => 'la_Always', 0 => 'la_Never' ), 'use_phrases' => 1, 'not_null' => 1, 'default' => 2 ),
'EditorsPick' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0,
),
'Featured' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0,
),
'OnSale' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0,
),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'CachedRating' => Array ('type' => 'string', 'not_null' => 1, 'formatter' => 'kFormatter', 'default' => 0),
'CachedVotesQty' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Hits' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%d', 'not_null' => 1, 'default' => 0),
'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
'Expire' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' =>null),
'Type' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'use_phrases' => 1,
'options' => Array (
PRODUCT_TYPE_TANGIBLE => 'la_product_tangible',
PRODUCT_TYPE_SUBSCRIPTION => 'la_product_subscription',
PRODUCT_TYPE_SERVICE => 'la_product_service',
PRODUCT_TYPE_DOWNLOADABLE => 'la_product_downloadable',
/* PRODUCT_TYPE_PACKAGE => 'la_product_package', */
),
'not_null' => 1, 'default' => 1,
),
'Modified' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
'ModifiedById' => Array ('type' => 'int', 'default' => NULL),
'CreatedById' => Array (
'type' => 'int',
'formatter' => 'kLEFTFormatter',
'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'),
'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE %s',
'left_key_field' => 'PortalUserId', 'left_title_field' => USER_TITLE_FIELD,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
'sample_value' => 'Guest', 'required' => 1, 'default' => NULL,
),
'ResourceId' => Array ('type' => 'int', 'default' => null),
'CachedReviewsQty' => Array ('type' => 'int', 'formatter' => 'kFormatter', 'format' => '%d', 'not_null' => 1, 'default' => 0),
'InventoryStatus' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_Disabled', 1 => 'la_by_product', 2 => 'la_by_options'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'QtyInStock' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'QtyInStockMin' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'QtyReserved' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'QtyBackOrdered' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'QtyOnOrder' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'InventoryComment' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'Qty' => Array ('type' => 'int', 'formatter' => 'kFormatter', 'regexp' => '/^[\d]+$/', 'error_msgs' => Array ('invalid_format' => '!la_invalid_integer!')),
'AccessGroupId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'UserGroups WHERE System!=1 AND Personal !=1 ORDER BY Name', 'option_key_field' => 'GroupId', 'option_title_field' => 'Name', 'default' => NULL),
'AccessDuration' => Array ('type' => 'int', 'default' => NULL),
'AccessDurationType' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' =>Array (1 => 'la_opt_sec', 2 => 'la_opt_min', 3 => 'la_opt_hour', 4 => 'la_opt_day', 5 => 'la_opt_week', 6 => 'la_opt_month', 7 => 'la_opt_year' ), 'default' => NULL,),
'AccessStart' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL),
'AccessEnd' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL,),
'OptionsSelectionMode' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' =>Array (0 => 'la_opt_Selection', 1 => 'la_opt_List'), 'default' => 0),
'HasRequiredOptions' => Array ('type' => 'int', 'default' => 0, 'not_null' => 1),
'Virtual' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'ProcessingData' => Array ('type' => 'string', 'default' => ''),
'PackageContent' => Array ('type' => 'string', 'default' => NULL),
'IsRecurringBilling' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 0,
),
//'PayPalRecurring' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => '1', 'default' => '0'),
'ShippingMode' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' =>Array (0 => 'la_shipping_AnyAndSelected', 1 => 'la_shipping_Limited'), 'not_null' => 1, 'default' =>0),
'ProcessingData' => Array ('type' => 'string', 'default' => null),
'ShippingLimitation' => Array ('type' => 'string', 'default' => NULL),
'AssignedCoupon' => Array (
'type' => 'int',
'formatter' => 'kLEFTFormatter', 'options' => Array (0 => 'None'),
'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'ProductsCoupons WHERE %s',
'left_key_field' => 'CouponId', 'left_title_field' => 'Name',
'not_null' => 1, 'default' => 0,
),
'MinQtyFreePromoShipping' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'MetaKeywords' => Array ('type' => 'string', 'default' => null),
'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
),
'VirtualFields' => Array (
'Relevance' => Array ('type' => 'float', 'default' => 0),
'Qty' => Array ('type' => 'int', 'formatter' => 'kFormatter', 'regexp' => '/^[\d]+$/', 'default' => 0),
'Price' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%.2f', 'default' => NULL),
'Cost' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%.2f', 'default' => NULL),
'CategoryFilename' => Array ('type' => 'string', 'default' => ''),
'PrimaryCat' => Array ('type' => 'int', 'default' => 0),
'IsHot' => Array ('type' => 'int', 'default' => 0),
'IsNew' => Array ('type' => 'int', 'default' => 0),
'IsPop' => Array ('type' => 'int', 'default' => 0),
'Manufacturer' => Array ('type' => 'string', 'default' => ''),
// export related fields: begin
'CategoryId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => 0),
'ExportFormat' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CSV', /*2 => 'XML'*/), 'default' => 1),
'ExportFilename' => Array ('type' => 'string', 'default' => ''),
'FieldsSeparatedBy' => Array ('type' => 'string', 'default' => ', '),
'FieldsEnclosedBy' => Array ('type' => 'string', 'default' => '"'),
'LineEndings' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'Windows', 2 => 'UNIX'), 'default' => 1),
'LineEndingsInside' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CRLF', 2 => 'LF'), 'default' => 2),
'IncludeFieldTitles' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'default' => 1,
),
'ExportColumns' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => ''),
'AvailableColumns' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array (), 'default' => ''),
'CategoryFormat' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_MixedCategoryPath', 2 => 'la_SeparatedCategoryPath'), 'use_phrases' => 1, 'default' => 1),
'CategorySeparator' => Array ('type' => 'string', 'default' => ':'),
'IsBaseCategory' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'default' => 0,
),
// export related fields: end
// import related fields: begin
'FieldTitles' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Automatic', 2 => 'la_Manual'), 'use_phrases' => 1, 'default' => 1),
'ImportSource' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Upload', 2 => 'la_Local'), 'use_phrases' => 1, 'default' => 2),
'ImportFilename' => Array ('type' => 'string', 'formatter' => 'kUploadFormatter', 'max_size' => MAX_UPLOAD_SIZE, 'upload_dir' => EXPORT_BASE_PATH . '/', 'default' => ''),
'ImportLocalFilename' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'default' => ''),
'CheckDuplicatesMethod' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_IDField', 2 => 'la_OtherFields'), 'use_phrases' => 1, 'default' => 1),
'ReplaceDuplicates' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'default' => 0),
'DuplicateCheckFields' => Array ('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array ('Name' => 'NAME'), 'default' => '|Name|'),
'SkipFirstRow' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'default' => 1),
// import related fields: end
'ThumbnailImage' => Array ('type' => 'string', 'default' => ''),
'FullImage' => Array ('type' => 'string', 'default' => ''),
'ImageAlt' => Array ('type' => 'string', 'default' => ''),
'Filename' => Array ('type' => 'string', 'default' => ''),
'CachedNavbar' => Array ('type' => 'string', 'default' => ''),
'ParentPath' => Array ('type' => 'string', 'default' => ''),
'FileSize' => Array ('type' => 'int', 'formatter' => 'kFilesizeFormatter', 'default' => 0),
'FilePath' => Array ('type' => 'string', 'default' => ''),
'FileVersion' => Array ('type' => 'string', 'default' => ''),
// for primary image
'AltName' => Array ('type' => 'string', 'default' => ''),
'SameImages' => Array ('type' => 'string', 'default' => ''),
'LocalThumb' => Array ('type' => 'string', 'default' => ''),
'ThumbPath' => Array ('type' => 'string', 'default' => ''),
'ThumbUrl' => Array ('type' => 'string', 'default' => ''),
'LocalImage' => Array ('type' => 'string', 'default' => ''),
'LocalPath' => Array ('type' => 'string', 'default' => ''),
'FullUrl' => Array ('type' => 'string', 'default' => ''),
),
'Grids' => Array (
'Default' => Array (
'Icons' => Array (
'default' => 'icon16_product.png',
0 => 'icon16_product_disabled.png',
1 => 'icon16_product.png',
2 => 'icon16_product_pending.png',
'NEW' => 'icon16_product_new.png',
),
'Fields' => Array (
'ProductId' => Array ( 'title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ),
'SKU' => Array ( 'title' => 'la_col_ProductSKU', 'filter_block' => 'grid_like_filter', 'width' => 100, ),
'Name' => Array ( 'title' => 'la_col_ProductName', 'data_block' => 'grid_catitem_td', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
'Priority' => Array ('filter_block' => 'grid_range_filter', 'width' => 65),
'Type' => Array ('title' => 'column:la_fld_ProductType', 'filter_block' => 'grid_options_filter', 'width' => 80, ),
'Manufacturer' => Array ('filter_block' => 'grid_like_filter', 'width' => 100, ),
'Price' => Array ('filter_block' => 'grid_range_filter', 'width' => 70, ),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 70, ),
'QtyInStock' => Array ('title' => 'column:la_fld_Qty', 'data_block' => 'qty_td', 'filter_block' => 'grid_range_filter', 'width' => 80, ),
'QtyBackOrdered' => Array ('title' => 'column:la_fld_QtyBackOrdered', 'filter_block' => 'grid_range_filter', 'width' => 80, ),
'OnSale' => Array ('title' => 'column:la_fld_OnSale', 'filter_block' => 'grid_options_filter', 'width' => 70, ),
/*'Weight' => Array ( 'title' => 'la_col_ProductWeight', 'filter_block' => 'grid_range_filter', 'width' => 150, ),
'CreatedOn' => Array ( 'title' => 'la_col_ProductCreatedOn', 'filter_block' => 'grid_date_range_filter', 'width' => 150, ),
'BackOrderDate' => Array ( 'title' => 'la_col_ProductBackOrderDate', 'filter_block' => 'grid_date_range_filter', 'width' => 150, ),*/
),
),
'Radio' => Array (
'Icons' => Array (
'default' => 'icon16_product.png',
0 => 'icon16_product_disabled.png',
1 => 'icon16_product.png',
2 => 'icon16_product_pending.png',
'NEW' => 'icon16_product_new.png',
),
'Selector' => 'radio',
'Fields' => Array (
'ProductId' => Array ( 'title' => 'column:la_fld_Id', 'data_block' => 'grid_radio_td', 'filter_block' => 'grid_range_filter', 'width' => 60, ),
'SKU' => Array ( 'title' => 'la_col_ProductSKU', 'filter_block' => 'grid_like_filter', 'width' => 100, ),
'Name' => Array ( 'title' => 'la_col_ProductName', 'data_block' => 'grid_catitem_td', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
'Priority' => Array ('filter_block' => 'grid_range_filter', 'width' => 65),
'Type' => Array ('title' => 'column:la_fld_ProductType', 'filter_block' => 'grid_options_filter', 'width' => 80, ),
'Manufacturer' => Array ('filter_block' => 'grid_like_filter', 'width' => 100, ),
'Price' => Array ('filter_block' => 'grid_range_filter', 'width' => 70, ),
'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 70, ),
'QtyInStock' => Array ('title' => 'column:la_fld_Qty', 'data_block' => 'qty_td', 'filter_block' => 'grid_range_filter', 'width' => 80, ),
'QtyBackOrdered' => Array ('title' => 'column:la_fld_QtyBackOrdered', 'filter_block' => 'grid_range_filter', 'width' => 80, ),
),
),
),
'ConfigMapping' => Array (
'PerPage' => 'Comm_Perpage_Products',
'ShortListPerPage' => 'Comm_Perpage_Products_Short',
'ForceEditorPick' => 'products_EditorPicksAboveRegular',
'DefaultSorting1Field' => 'product_OrderProductsBy',
'DefaultSorting2Field' => 'product_OrderProductsThenBy',
'DefaultSorting1Dir' => 'product_OrderProductsByDir',
'DefaultSorting2Dir' => 'product_OrderProductsThenByDir',
'RatingDelayValue' => 'product_RatingDelay_Value',
'RatingDelayInterval' => 'product_RatingDelay_Interval',
),
);
\ No newline at end of file
Index: branches/5.3.x/units/order_items/order_items_event_handler.php
===================================================================
--- branches/5.3.x/units/order_items/order_items_event_handler.php (revision 15898)
+++ branches/5.3.x/units/order_items/order_items_event_handler.php (revision 15899)
@@ -1,368 +1,369 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class OrderItemsEventHandler extends kDBEventHandler
{
/**
* Allows to override standard permission mapping
*
* @return void
* @access protected
* @see kEventHandler::$permMapping
*/
protected function mapPermissions()
{
parent::mapPermissions();
$permissions = Array (
'OnItemBuild' => Array ('subitem' => true),
'OnSaveItems' => Array ('subitem' => 'add|edit'),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
/**
* Processes item selection from popup item selector
*
* @param kEvent $event
*/
function OnProcessSelected($event)
{
$object = $event->getObject( Array('skip_autoload' => true) );
$selected_ids = $this->Application->GetVar('selected_ids');
$product_ids = $selected_ids['p'];
if ($product_ids) {
//after adding Options Selection during adding products to order in admin, selector is in single mode
// = allows selecting one item at a time, but we leave this code just in case :)
$product_ids = explode(',', $product_ids);
$product_object = $this->Application->recallObject('p.-item', null, array('skip_autoload' => true));
/* @var $product_object ProductsItem */
foreach ($product_ids as $product_id) {
$product_object->Load($product_id);
$sql = 'SELECT COUNT(*)
FROM ' . $this->Application->getUnitConfig('po')->getTableName() . '
WHERE (Required = 1) AND (ProductId = ' . $product_id . ')';
if ( $this->Conn->GetOne($sql) ) {
$url_params = Array (
$event->Prefix . '_event' => 'OnNew',
'p_id' => $product_id,
'm_opener' => 's',
'pass' => 'm,ord,p',
);
$this->Application->EventManager->openerStackPush('in-commerce/orders/order_product_edit', $url_params);
}
else {
$orders_h = $this->Application->recallObject('ord_EventHandler');
/* @var $orders_h OrdersEventHandler */
// 1 for PacakgeNum - temporary solution to overcome splitting into separate sub-orders
// of orders with items added through admin when approving them
$orders_h->AddItemToOrder($event, $product_id, null, 1);
}
}
}
$event->SetRedirectParam('opener', 'u');
}
/**
* Updates subtotal field in order record.
* Only for "Items" tab in "Orders -> Order Edit" in Admin
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnUpdate(kEvent $event)
{
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
if ( !$items_info ) {
return;
}
$object = $event->getObject(Array ('skip_autoload' => true));
/* @var $object kDBItem */
$table_info = $object->getLinkedInfo();
$main_object = $this->Application->recallObject($table_info['ParentPrefix']);
/* @var $main_object OrdersItem */
foreach ($items_info as $id => $field_values) {
$object->Clear(); // otherwise validation errors will be passed to next object
$object->Load($id);
$object->SetFieldsFromHash($field_values, $this->getRequestProtectedFields($field_values));
+ $event->setEventParam('form_data', $field_values);
$this->customProcessing($event, 'before');
if ( $object->Update($id) ) {
$this->customProcessing($event, 'after');
$event->status = kEvent::erSUCCESS;
}
else {
$oi_string = $object->GetDBField('ProductId') . ':' . $object->GetDBField('OptionsSalt') . ':' . $object->GetDBField('BackOrderFlag');
$field_errors = $object->GetFieldErrors();
foreach ($field_errors as $field => $error_params) {
$error_msg = $object->GetErrorMsg($field);
if ( $error_msg ) {
$main_object->setCheckoutError(OrderCheckoutErrorType::PRODUCT, OrderCheckoutError::FIELD_UPDATE_ERROR, $oi_string . ':' . $field);
}
}
$event->status = kEvent::erFAIL;
$event->redirect = false;
// break;
}
}
if ( $this->Application->GetVar('t') != 'in-commerce/orders/orders_edit_items' ) {
return;
}
$sub_total = $this->getSubTotal($items_info);
if ( $sub_total !== false ) {
$main_object->SetDBField('SubTotal', $sub_total);
}
$main_object->SetDBField('ReturnTotal', $this->getReturnTotal($items_info));
$main_object->Update();
}
/**
* Remembers what fields were changed
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemUpdate(kEvent $event)
{
parent::OnAfterItemUpdate($event);
if ( $this->Application->isAdmin ) {
return;
}
$object = $event->getObject();
/* @var $object kDBItem */
$changed_fields = $object->GetChangedFields();
if ( $changed_fields ) {
$table_info = $object->getLinkedInfo();
$main_object = $this->Application->recallObject($table_info['ParentPrefix']);
/* @var $main_object OrdersItem */
$oi_string = $object->GetDBField('ProductId') . ':' . $object->GetDBField('OptionsSalt') . ':' . $object->GetDBField('BackOrderFlag');
foreach ($changed_fields as $changed_field => $change_info) {
$error_code = OrderCheckoutError::FIELD_UPDATE_SUCCESS;
if ( $changed_field == 'ItemData' ) {
$item_data_old = unserialize($change_info['old']);
$item_data_new = unserialize($change_info['new']);
if ( $item_data_old['DiscountId'] != $item_data_new['DiscountId'] || $item_data_old['DiscountType'] != $item_data_new['DiscountType'] ) {
if ( $item_data_new['DiscountId'] > 0 ) {
$error_code = $item_data_new['DiscountType'] == 'discount' ? OrderCheckoutError::DISCOUNT_APPLIED : OrderCheckoutError::COUPON_APPLIED;
}
else {
$error_code = $item_data_old['DiscountType'] == 'discount' ? OrderCheckoutError::DISCOUNT_REMOVED : OrderCheckoutError::COUPON_REMOVED;
}
}
if ( $error_code == OrderCheckoutError::DISCOUNT_APPLIED || $error_code == OrderCheckoutError::DISCOUNT_REMOVED ) {
// set general error too
$main_object->setCheckoutError(OrderCheckoutErrorType::DISCOUNT, $error_code);
}
}
elseif ( $changed_field == 'Quantity' && $this->Application->isDebugMode() ) {
// here is how qty is changed:
// OLD QTY -> NEW QTY
// RECALCULATE
// NEW QTY = IN_STOCK_QTY
// NEW ORDER ITEM with LEFTOVER QTY
$this->Application->Debugger->appendTrace();
$this->Application->Debugger->appendHTML('QTY_CHANGE (' . $oi_string . '): ' . $change_info['old'] . ' => ' . $change_info['new']);
}
$main_object->setCheckoutError(OrderCheckoutErrorType::PRODUCT, $error_code, $oi_string . ':' . $changed_field);
}
}
}
/**
* Returns subtotal
*
* @param Array $items_info
* @return float
*/
function getSubTotal($items_info)
{
$sub_total = 0;
foreach ($items_info as $id => $field_values) {
if (!array_key_exists('Price', $field_values)) {
return false;
}
$sub_total += $field_values['Quantity'] * $field_values['Price'];
}
return $sub_total;
}
/**
* Returns total returned amount (refund)
*
* @param Array $items_info
* @return float
*/
function getReturnTotal($items_info)
{
$return_total = 0;
foreach ($items_info as $id => $field_values) {
$return_total += $field_values['ReturnAmount'];
}
return $return_total;
}
/**
* Saves selected items
*
* @param kEvent $event
*/
function OnSaveItems($event)
{
$event->CallSubEvent('OnUpdate');
$event->redirect = false;
$event->SetRedirectParam('opener', 's');
$event->SetRedirectParam('pass', 'all');
}
/**
* Occurs after an item has been cloned
* Id of newly created item is passed as event' 'id' param
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterClone(kEvent $event)
{
parent::OnAfterClone($event);
$config = $event->getUnitConfig();
$sql = 'UPDATE ' . $config->getTableName() . '
SET QuantityReserved = NULL
WHERE ' . $config->getIDField() . ' = ' . $event->getEventParam('id');
$this->Conn->Query($sql);
}
/**
* Occurs after loading item, 'id' parameter
* allows to get id of item that was loaded
*
* @param kEvent $event
* @return void
* @access protected
*/
protected function OnAfterItemLoad(kEvent $event)
{
parent::OnAfterItemLoad($event);
$object = $event->getObject();
/* @var $object kDBItem */
$item_info = $object->GetDBField('ItemData');
if ( $item_info ) {
$item_info = unserialize($item_info);
$object->SetDBField('DiscountType', getArrayValue($item_info, 'DiscountType'));
$object->SetDBField('DiscountId', getArrayValue($item_info, 'DiscountId'));
}
}
/**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
* @return void
* @access protected
* @see kDBEventHandler::OnListBuild()
*/
protected function SetCustomQuery(kEvent $event)
{
parent::SetCustomQuery($event);
$object = $event->getObject();
/* @var $object kDBList */
$package_num = $event->getEventParam('package_num');
if ( $package_num ) {
$object->addFilter('package_num', 'PackageNum = ' . $package_num);
}
$type = $event->getEventParam('product_type');
if ( $type ) {
$object->addFilter('product_type', 'p.Type =' . $type);
}
}
/**
* Checks, that currently loaded item is allowed for viewing (non permission-based)
*
* @param kEvent $event
* @return bool
* @access protected
*/
protected function checkItemStatus(kEvent $event)
{
if ( $this->Application->isAdmin ) {
return true;
}
$object = $event->getObject();
/* @var $object kDBItem */
if ( !$object->isLoaded() ) {
return true;
}
$order = $this->Application->recallObject('ord');
/* @var $order kDBItem */
if ( $order->isLoaded() && ($order->GetID() == $object->GetDBField('OrderId')) ) {
return $order->GetDBField('PortalUserId') == $this->Application->RecallVar('user_id');
}
return false;
}
}
\ No newline at end of file
Index: branches/5.3.x/units/order_items/order_items_config.php
===================================================================
--- branches/5.3.x/units/order_items/order_items_config.php (revision 15898)
+++ branches/5.3.x/units/order_items/order_items_config.php (revision 15899)
@@ -1,177 +1,177 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'orditems',
'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'OrderItemsEventHandler', 'file' => 'order_items_event_handler.php', 'build_event' => 'OnBuild'),
'TagProcessorClass' => Array ('class' => 'OrderItemsTagProcessor', 'file' => 'order_items_tag_processor.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
'AggregateTags' => Array (
Array (
'AggregateTo' => '#PARENT#',
'AggregatedTagName' => 'ItemFieldEquals',
'LocalTagName' => 'FieldEquals',
),
),
'Hooks' => Array (
Array (
'Mode' => hBEFORE,
'Conditional' => false,
'HookToPrefix' => '#PARENT#',
'HookToSpecial' => '',
'HookToEvent' => Array ('OnPreSave', 'OnRecalculateItems'),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnUpdate',
),
),
'QueryString' => Array (
1 => 'id',
2 => 'Page',
3 => 'PerPage',
4 => 'event',
),
'IDField' => 'OrderItemId',
'TitleField' => 'OrderItemId',
'StatusField' => Array ('Status'),
'TableName' => TABLE_PREFIX.'OrderItems',
'ParentTableKey' => 'OrderId',
'ForeignKey' => 'OrderId',
'ParentPrefix' => 'ord',
'AutoDelete' => true,
'AutoClone' => true,
'ItemType' => 11,
'CalculatedFields' => Array (
'' => Array (
'ExtendedPrice' => '%1$s.Price * %1$s.Quantity',
'ExtendedPriceFlat' => '%1$s.FlatPrice * %1$s.Quantity',
'QuantityAvailable' => 'IF( ISNULL(p.QtyInStock) AND ISNULL(p.ProductId),"!la_ProductDeleted!", IF(p.Type = 1, IF(p.InventoryStatus = 2, poc.QtyInStock, p.QtyInStock), "") )',
'ItemDiscount' => '(%1$s.FlatPrice - %1$s.Price)',
'SKU' => 'IF(p.InventoryStatus = 2 OR NOT ISNULL(poc.CombinationCRC), poc.SKU, p.SKU)', // inventory by options OR combination found
),
),
'ListSQLs' => Array (
'' => ' SELECT %1$s.*, p.* %2$s
FROM %1$s
LEFT JOIN '.TABLE_PREFIX.'Products p ON %1$s.ProductId = p.ProductId
LEFT JOIN '.TABLE_PREFIX.'ProductOptionCombinations poc ON (%1$s.ProductId = poc.ProductId) AND (%1$s.OptionsSalt = poc.CombinationCRC)',
),
'ItemSQLs' => Array (
'' => ' SELECT *, (Quantity*Price) AS ExtendedPrice, 0 AS QuantityAvailable
FROM %s',
),
'ListSortings' => Array (
'' => Array (
'Sorting' => Array ('ProductName' => 'asc', 'BackOrderFlag' => 'asc'),
)
),
'Fields' => Array (
'OrderItemId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'OrderId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'ProductId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'ProductName' => Array ('type' => 'string', 'not_null' => 1, 'default' => ''),
'Quantity' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'QuantityReserved' => Array ('type' => 'int', 'default' => null),
'FlatPrice' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'not_null' => '1', 'default' => '0.0000'),
'Price' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'not_null' => '1', 'default' => '0.0000'),
'Cost' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'not_null' => '1', 'default' => '0.0000'),
'BackOrderFlag' => Array ('type' => 'int', 'default' => 0),
'Weight' => Array ('type' => 'double', 'default' => NULL),
'ShippingTypeId' => Array ('type' => 'string', 'default' => NULL),
'ItemData' => Array ('type' => 'string', 'default' => null),
- 'OptionsSalt' => Array ('type' => 'int', 'default' => 0),
+ 'OptionsSalt' => Array ('type' => 'string', 'default' => 0),
'SplitShippingGroup' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0,),
'PackageNum' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0,),
'ReturnType' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Refund', 2 => 'la_opt_Exchange', 3 => 'la_opt_Warranty'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 0
),
'ReturnAmount' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'not_null' => 1, 'default' => 0),
'ReturnedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => NULL),
),
'VirtualFields' => Array (
'ExtendedPrice' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'default' => '0.00'),
'ExtendedPriceFlat' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'default' => '0.00'),
'QuantityAvailable' => Array ('type' => 'int', 'default'=>0),
'DiscountType' => Array ('type' => 'string', 'default' => ''),
'DiscountId' => Array ('type' => 'int', 'default'=>0),
'Name' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => ''),
'ItemDiscount' => Array ('type' => 'double', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'default' => '0.00'),
'SKU' => Array ('type' => 'string', 'default' => ''),
'MinQtyFreeShipping'=> Array ('type' => 'int', 'default' => 0,),
'Virtual' => Array ('type' => 'int', 'default' => 0),
),
'Grids' => Array (
'Default' => Array (
'Icons' => Array (
'default' => 'icon16_product.png',
0 => 'icon16_product_disabled.png',
1 => 'icon16_product.png',
2 => 'icon16_product_pending.png',
),
'Fields' => Array (
'ProductName' => Array ('title' => 'la_col_ProductNameId', 'data_block' => 'grid_productname_td', 'filter_block' => 'grid_like_filter'),
'Quantity' => Array ('title' => 'la_col_Quantity', 'data_block' => 'grid_quantity_td', 'filter_block' => 'grid_range_filter'),
'QuantityReserved' => Array ('title' => 'la_col_QuantityReserved', 'filter_block' => 'grid_range_filter'),
'QuantityAvailable' => Array ('title' => 'la_col_QuantityAvailable', 'filter_block' => 'grid_range_filter'),
'Price' => Array ('data_block' => 'grid_price_td', 'filter_block' => 'grid_range_filter'),
'ExtendedPrice' => Array ('title' => 'la_col_ExtendedPrice', 'data_block' => 'grid_extendedprice_td', 'filter_block' => 'grid_range_filter'),
'ReturnType' => Array ('title' => 'la_col_ReturnType', 'data_block' => 'grid_options_td', 'filter_block' => 'grid_options_filter'),
'ReturnAmount' => Array ('title' => 'la_col_ReturnAmount', 'data_block' => 'grid_edit_td', 'filter_block' => 'grid_range_filter'),
'ReturnedOn' => Array ('title' => 'la_col_ReturnedOn', 'data_block' => 'grid_date_td', 'filter_block' => 'grid_date_range_filter'),
),
),
'NotEditable' => Array (
'Icons' => Array (
'default' => 'icon16_product.png',
0 => 'icon16_product_disabled.png',
1 => 'icon16_product.png',
2 => 'icon16_product_pending.png',
),
'Fields' => Array (
'ProductName' => Array ('title' => 'la_col_ProductNameId', 'data_block' => 'grid_productname_td'),
'Quantity' => Array ('title' => 'la_col_Quantity', 'filter_block' => 'grid_range_filter'),
'QuantityReserved' => Array ('title' => 'la_col_QuantityReserved', 'filter_block' => 'grid_range_filter'),
'QuantityAvailable' => Array ('title' => 'la_col_QuantityAvailable', 'filter_block' => 'grid_range_filter'),
'Price' => Array ('filter_block' => 'grid_range_filter'),
'ExtendedPrice' => Array ('title' => 'la_col_ExtendedPrice', 'filter_block' => 'grid_range_filter'),
'ReturnType' => Array ('title' => 'la_col_ReturnType', 'data_block' => 'grid_options_td', 'filter_block' => 'grid_options_filter'),
'ReturnAmount' => Array ('title' => 'la_col_ReturnAmount', 'data_block' => 'grid_edit_td', 'filter_block' => 'grid_range_filter'),
'ReturnedOn' => Array ('title' => 'la_col_ReturnedOn', 'data_block' => 'grid_date_td', 'filter_block' => 'grid_date_range_filter'),
),
),
),
);
\ No newline at end of file
Index: branches/5.3.x/units/order_items/order_items_tag_processor.php
===================================================================
--- branches/5.3.x/units/order_items/order_items_tag_processor.php (revision 15898)
+++ branches/5.3.x/units/order_items/order_items_tag_processor.php (revision 15899)
@@ -1,300 +1,305 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class OrderItemsTagProcessor extends kDBTagProcessor
{
function PrintGrid($params)
{
$order = $this->Application->recallObject('ord');
/* @var $order kDBList */
if ( $order->GetDBField('Status') != ORDER_STATUS_INCOMPLETE ) {
$params['grid'] = $params['NotEditable'];
}
else {
$params['grid'] = $params['Editable'];
}
return $this->Application->ProcessParsedTag('m', 'ParseBlock', $params);
}
function IsTangible($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
return $object->GetDBField('Type') == PRODUCT_TYPE_TANGIBLE;
}
function HasQty($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
return in_array($object->GetDBField('Type'), Array (PRODUCT_TYPE_TANGIBLE, 6));
}
function HasDiscount($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
return (float)$object->GetDBField('ItemDiscount') ? 1 : 0;
}
function HasOptions($params)
{
$object = $this->getObject($params);
$item_data = @unserialize($object->GetDBField('ItemData'));
return isset($item_data['Options']);
}
function PrintOptions($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$item_data = @unserialize($object->GetDBField('ItemData'));
$render_as = $this->SelectParam($params, 'render_as');
$block_params['name'] = $render_as;
$opt_helper = $this->Application->recallObject('kProductOptionsHelper');
/* @var $opt_helper kProductOptionsHelper */
$o = '';
$options = $item_data['Options'];
foreach ($options as $opt => $val) {
if ( !is_array($val) ) {
$val = htmlspecialchars_decode($val);
}
$key_data = $opt_helper->ConvertKey($opt, $object->GetDBField('ProductId'));
$parsed = $opt_helper->ExplodeOptionValues($key_data);
if ( $parsed ) {
$values = $parsed['Values'];
$prices = $parsed['Prices'];
$price_types = $parsed['PriceTypes'];
}
else {
$values = array ();
$prices = array ();
$price_types = array ();
}
$key = $key_data['Name'];
/*if (is_array($val)) {
$val = join(',', $val);
}*/
$lang = $this->Application->recallObject('lang.current');
/* @var $lang LanguagesItem */
if ( $render_as ) {
$block_params['option'] = $key;
if ( is_array($val) ) {
$block_params['value'] = $val;
$block_params['type'] = $key_data['OptionType'];
$block_params['price'] = $prices;
$block_params['price_type'] = $price_types;
}
else {
$price_type = array_key_exists($val, $price_types) ? $price_types[$val] : '';
$price = array_key_exists($val, $prices) ? $prices[$val] : '';
if ( $price_type == '$' ) {
$iso = $this->GetISO($params['currency']);
$value = $this->AddCurrencySymbol($lang->formatNumber($this->ConvertCurrency($price, $iso), 2), $iso, true); // true to force sign
$block_params['price'] = $value;
$block_params['price_type'] = '';
$block_params['sign'] = ''; // sign is included in the formatted value
}
else {
$block_params['price'] = $price;
$block_params['price_type'] = $price_type;
$block_params['sign'] = $price >= 0 ? '+' : '-';
}
- $block_params['value'] = htmlspecialchars($val, null, CHARSET);
+
+ // TODO: consider escaping in template instead
+ $block_params['value'] = kUtil::escape($val);
$block_params['type'] = $key_data['OptionType'];
}
$o .= $this->Application->ParseBlock($block_params, 1);
}
else {
$o .= $key . ': ' . $val . '<br>';
}
}
return $o;
}
function ProductsInStock($params)
{
$object = $this->getObject($params);
if (!$object->GetDBField('InventoryStatus')) {
// unlimited count available
return false;
}
if ($object->GetDBField('InventoryStatus') == 2) {
$poc_table = $this->Application->getUnitConfig('poc')->getTableName();
$sql = 'SELECT QtyInStock
FROM '.$poc_table.'
WHERE (ProductId = '.$object->GetDBField('ProductId').') AND (Availability = 1) AND (CombinationCRC = '.$object->GetDBField('OptionsSalt').')';
$ret = $this->Conn->GetOne($sql);
}
else {
$ret = $object->GetDBField('QtyInStock');
}
return $ret;
}
function PrintOptionValues($params)
{
$block_params['name'] = $params['render_as'];
$values = $this->Application->Parser->GetParam('value');
/* @var $values Array */
$prices = $this->Application->Parser->GetParam('price');
$price_types = $this->Application->Parser->GetParam('price_type');
$o = '';
$i = 0;
foreach ($values as $val) {
$i++;
$val = htmlspecialchars_decode($val);
- $block_params['value'] = htmlspecialchars($val, null, CHARSET);
+
+ // TODO: consider escaping in template instead
+ $block_params['value'] = kUtil::escape($val);
+
if ($price_types[$val] == '$') {
$iso = $this->GetISO($params['currency']);
$value = $this->AddCurrencySymbol(sprintf("%.2f", $this->ConvertCurrency($prices[$val], $iso)), $iso, true); // true to force sign
$block_params['price'] = $value;
$block_params['price_type'] = '';
$block_params['sign'] = ''; // sign is included in the formatted value
}
else {
$block_params['price'] = $prices[$val];
$block_params['price_type'] = $price_types[$val];
$block_params['sign'] = $prices[$val] >= 0 ? '+' : '-';
}
$block_params['is_last'] = $i == count($values);
$o.= $this->Application->ParseBlock($block_params, 1);
}
return $o;
}
/*function ConvertKey($key, &$object)
{
static $mapping = null;
if (is_null($mapping) || !isset($mapping[$object->GetDBField('ProductId')])) {
$table = TABLE_PREFIX.'ProductOptions';
$sql = 'SELECT * FROM '.$table.' WHERE ProductId = '.$object->GetDBField('ProductId');
$mapping[$object->GetDBField('ProductId')] = $this->Conn->Query($sql, 'ProductOptionId');
}
return $mapping[$object->GetDBField('ProductId')][$key];
}*/
function PrintList($params)
{
$list =& $this->GetList($params);
$id_field = $this->getUnitConfig()->getIDField();
$list->Query();
$o = '';
$list->GoFirst();
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['pass_params'] = 'true';
$product_object = $this->Application->recallObject('p', 'p', Array ('skip_autoload' => true));
/* @var $product_object kCatDBItem */
$i = 0;
$product_id = $product_object->GetID();
$product_id_get = $this->Application->GetVar('p_id');
while (!$list->EOL()) {
// load product used in orderitem
$this->Application->SetVar($this->getPrefixSpecial() . '_id', $list->GetDBField($id_field)); // for edit/delete links using GET
$this->Application->SetVar('p_id', $list->GetDBField('ProductId'));
$product_object->Load($list->GetDBField('ProductId')); // correct product load
$this->Application->SetVar('m_cat_id', $product_object->GetDBField('CategoryId'));
$block_params['is_last'] = ($i == $list->GetSelectedCount() - 1);
$o .= $this->Application->ParseBlock($block_params, 1);
$list->GoNext();
$i++;
}
// restore IDs used in cycle
$this->Application->SetVar('p_id', $product_id_get);
$this->Application->DeleteVar($this->getPrefixSpecial() . '_id');
if ( $product_id ) {
$product_object->Load($product_id);
}
return $o;
}
function DisplayOptionsPricing($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
if ( $object->GetDBField('OptionsSelectionMode') == 1 ) {
return false;
}
$item_data = unserialize($object->GetDBField('ItemData'));
if ( !is_array($item_data) ) {
return false;
}
$options = getArrayValue($item_data, 'Options');
$helper = $this->Application->recallObject('kProductOptionsHelper');
/* @var $helper kProductOptionsHelper */
$crc = $helper->OptionsSalt($options, true);
$sql = 'SELECT COUNT(*)
FROM ' . TABLE_PREFIX . 'ProductOptionCombinations
WHERE CombinationCRC = ' . $crc . ' AND ProductId = ' . $object->GetDBField('ProductId') . ' AND (Price != 0 OR (PriceType = 1 AND Price = 0))';
return $this->Conn->GetOne($sql) == 0; // no overriding combinations found
}
function RowIndex($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
return $object->GetDBField('ProductId') . ':' . $object->GetDBField('OptionsSalt') . ':' . $object->GetDBField('BackOrderFlag');
}
function FreePromoShippingAvailable($params)
{
$object = $this->getObject($params);
/* @var $object kDBItem */
$order_helper = $this->Application->recallObject('OrderHelper');
/* @var $order_helper OrderHelper */
return $order_helper->eligibleForFreePromoShipping($object);
}
}
\ No newline at end of file
Index: branches/5.3.x/admin_templates/affiliate_plans/affiliate_plans_edit.tpl
===================================================================
--- branches/5.3.x/admin_templates/affiliate_plans/affiliate_plans_edit.tpl (revision 15898)
+++ branches/5.3.x/admin_templates/affiliate_plans/affiliate_plans_edit.tpl (revision 15899)
@@ -1,105 +1,105 @@
<inp2:adm_SetPopupSize width="750" height="400"/>
<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="ap" section="in-commerce:affiliate_plans" title_preset="affiliate_plans_edit" tab_preset="Default"/>
<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
a_toolbar = new ToolBar();
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
submit_event('ap','<inp2:ap_SaveEvent/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
submit_event('ap','OnCancelEdit');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
go_to_id('ap', '<inp2:ap_PrevId/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
go_to_id('ap', '<inp2:ap_NextId/>');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
a_toolbar.Render();
<inp2:m_if check="ap_IsSingle" >
a_toolbar.HideButton('prev');
a_toolbar.HideButton('next');
a_toolbar.HideButton('sep1');
a_toolbar.HideButton('sep2');
<inp2:m_else/>
<inp2:m_if check="ap_IsLast" >
a_toolbar.DisableButton('next');
</inp2:m_if>
<inp2:m_if check="ap_IsFirst" >
a_toolbar.DisableButton('prev');
</inp2:m_if>
</inp2:m_if>
</script>
</td>
</tr>
</tbody>
</table>
<inp2:ap_SaveWarning name="grid_save_warning"/>
<inp2:ap_ErrorWarning name="form_error_warning"/>
<div id="scroll_container">
<table class="edit-form">
<inp2:m_RenderElement name="subsection" title="la_section_General"/>
<inp2:m_RenderElement name="inp_label" prefix="ap" field="AffiliatePlanId" title="la_fld_Id"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="ap" field="Name" title="la_fld_Name" size="40"/>
<inp2:m_RenderElement name="inp_edit_radio" prefix="ap" field="PlanType" title="la_fld_PlanType"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="ap" field="ResetInterval" title="la_fld_Period"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="ap" field="IsPrimary" title="la_fld_Primary" onchange="check_status()" />
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="ap" field="Enabled" title="la_fld_Enabled" onchange="check_primary()"/>
<inp2:m_RenderElement design="form_row" prefix="ap" field="MinPaymentAmount" title="la_fld_MinimumPaymentAmount">
<td class="control-cell">
- <input type="text" name="<inp2:ap_InputName field='MinPaymentAmount' />" id="<inp2:ap_InputName field='MinPaymentAmount' />" value="<inp2:ap_Field name='MinPaymentAmount' />" tabindex="<inp2:m_get param='tab_index'/>" size="8">
+ <input type="text" name="<inp2:$prefix_InputName field='$field' />" id="<inp2:$prefix_InputName field='$field' />" value="<inp2:$prefix_Field name='$field' />" tabindex="<inp2:m_get param='tab_index'/>" size="8"/>
<span class="small">(<inp2:curr_PrimaryCurrencyISO />)</span>
</td>
</inp2:m_RenderElement>
<inp2:m_RenderElement name="inp_edit_filler"/>
</table>
</div>
<script type="text/javascript">
if(document.getElementById('_cb_<inp2:ap_InputName field="IsPrimary"/>').checked)
{
document.getElementById('_cb_<inp2:ap_InputName field="IsPrimary"/>').disabled = true;
document.getElementById('_cb_<inp2:ap_InputName field="Enabled"/>').disabled = true;
}
function check_status()
{
if(document.getElementById('_cb_<inp2:ap_InputName field="IsPrimary"/>').checked)
{
document.getElementById('_cb_<inp2:ap_InputName field="Enabled"/>').checked = true;
document.getElementById('<inp2:ap_InputName field="Enabled"/>').value = 1;
}
}
function check_primary()
{
if(!document.getElementById('_cb_<inp2:ap_InputName field="Enabled"/>').checked)
{
document.getElementById('_cb_<inp2:ap_InputName field="IsPrimary"/>').checked = false;
document.getElementById('<inp2:ap_InputName field="IsPrimary"/>').value = 0;
}
}
</script>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: branches/5.3.x/admin_templates/products/products_access.tpl
===================================================================
--- branches/5.3.x/admin_templates/products/products_access.tpl (revision 15898)
+++ branches/5.3.x/admin_templates/products/products_access.tpl (revision 15899)
@@ -1,109 +1,130 @@
<inp2:adm_SetPopupSize width="1000" height="680"/>
<inp2:m_include t="incs/header"/>
<inp2:m_RenderElement name="combined_header" prefix="p" section="in-portal:browse" pagination="1" pagination_prefix="pr" grid="Access" title_preset="access" tab_preset="Default"/>
<!-- ToolBar -->
<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<script type="text/javascript">
a_toolbar = new ToolBar();
+
a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
submit_event('p','<inp2:p_SaveEvent/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
submit_event('p','OnCancelEdit');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
go_to_id('p', '<inp2:p_PrevId/>');
}
) );
a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
go_to_id('p', '<inp2:p_NextId/>');
}
) );
a_toolbar.AddButton( new ToolBarSeparator('sep2') );
// a_toolbar.AddButton( new ToolBarSeparator('sep3') );
//Pricing related:
- a_toolbar.AddButton( new ToolBarButton('new_item', '<inp2:m_phrase label="la_ToolTip_NewPricing" escape="1"/>::<inp2:m_phrase label="la_ToolTip_Add" escape="1"/>',
- function() {
+ a_toolbar.AddButton(
+ new ToolBarButton('new_item', '<inp2:m_phrase label="la_ToolTip_NewPricing" escape="1"/>::<inp2:m_phrase label="la_ToolTip_Add" escape="1"/>',
+ function() {
+ save_product_ajax(function () {
std_new_item('pr', 'in-commerce/products/access_pricing_edit')
- } ) );
+ });
+ })
+ );
function edit()
{
- std_edit_temp_item('pr', 'in-commerce/products/access_pricing_edit');
+ save_product_ajax(function () {
+ std_edit_temp_item('pr', 'in-commerce/products/access_pricing_edit');
+ });
}
+ function save_product_ajax($callback) {
+ $.post(
+ '<inp2:m_Link p_event="OnPreSaveAjax" pass="m,p" no_amp="1" js_escape="1"/>',
+ $('#' + $form_name).serialize(),
+ function ($data) {
+ $data = eval('(' + $data + ')');
+
+ if ($data.status == 'OK') {
+ $callback();
+ }
+ }
+ );
+ }
+
a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>', edit) );
a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
function() {
std_delete_items('pr')
} ) );
a_toolbar.AddButton( new ToolBarButton('setprimary', '<inp2:m_phrase label="la_ToolTip_SetPrimary" escape="1"/>', function() {
submit_event('pr','OnSetPrimary');
}
) );
a_toolbar.Render();
<inp2:m_if check="p_IsSingle" >
a_toolbar.HideButton('prev');
a_toolbar.HideButton('next');
// a_toolbar.HideButton('sep1');
a_toolbar.HideButton('sep2');
<inp2:m_else/>
<inp2:m_if check="p_IsLast" >
a_toolbar.DisableButton('next');
</inp2:m_if>
<inp2:m_if check="p_IsFirst" >
a_toolbar.DisableButton('prev');
</inp2:m_if>
</inp2:m_if>
</script>
</td>
<inp2:m_RenderElement name="search_main_toolbar" prefix="pr" grid="Access"/>
</tr>
</tbody>
</table>
<div id="scroll_container" mode="minimal">
<table class="edit-form" style="border-bottom: 1px solid black;">
<inp2:m_RenderElement name="subsection" title="la_section_Product"/>
<inp2:m_RenderElement name="inp_edit_options" prefix="p" field="AccessGroupId" title="la_fld_AccessGroup" has_empty="1"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="p" field="IsRecurringBilling" title="la_fld_IsRecurringBilling"/>
-
+
<!--## TODO check on implementation of this field
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="p" field="PayPalRecurring" title="la_fld_IsPayPalRecurring"/>
##-->
-
- <!--## TODO check on implementation of these fields
+
+ <!--## TODO check on implementation of these fields
<inp2:m_RenderElement name="inp_edit_box" prefix="p" field="AccessDuration" title="la_fld_AccessDuration" size="4" />
<inp2:m_RenderElement name="inp_edit_options" prefix="p" field="AccessDurationType" title="la_fld_AccessDurationType" size="20"/>
<inp2:m_RenderElement name="inp_edit_date_time" prefix="p" field="AccessStart" title="la_fld_AccessStart" size="10" />
<inp2:m_RenderElement name="inp_edit_date_time" prefix="p" field="AccessEnd" title="la_fld_AccessEnd" size="10" />
##-->
<inp2:m_RenderElement name="inp_edit_filler"/>
</table>
</div>
<inp2:m_RenderElement name="grid" PrefixSpecial="pr" IdField="PriceId" grid="Access" />
<script type="text/javascript">
Grids['pr'].SetDependantToolbarButtons( new Array('edit','delete', 'setprimary') );
</script>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: branches/5.3.x/install/upgrades.php
===================================================================
--- branches/5.3.x/install/upgrades.php (revision 15898)
+++ branches/5.3.x/install/upgrades.php (revision 15899)
@@ -1,190 +1,192 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
$upgrade_class = 'InCommerceUpgrades';
/**
* Class, that holds all upgrade scripts for "In-Commerce" module
*
*/
class InCommerceUpgrades extends kUpgradeHelper {
public function __construct()
{
parent::__construct();
$this->dependencies = Array (
'4.3.9' => Array ('Core' => '4.3.9'),
'5.0.0' => Array ('Core' => '5.0.0'),
'5.0.1' => Array ('Core' => '5.0.1'),
'5.0.2-B1' => Array ('Core' => '5.0.2-B1'),
'5.0.2-B2' => Array ('Core' => '5.0.2-B2'),
'5.0.2-RC1' => Array ('Core' => '5.0.2-RC1'),
'5.0.2' => Array ('Core' => '5.0.2'),
'5.0.3-B1' => Array ('Core' => '5.0.3-B1'),
'5.0.3-B2' => Array ('Core' => '5.0.3-B2'),
'5.0.3-RC1' => Array ('Core' => '5.0.3-RC1'),
'5.0.3' => Array ('Core' => '5.0.3'),
'5.0.4-B1' => Array ('Core' => '5.0.4-B1'),
'5.0.4-B2' => Array ('Core' => '5.0.4-B2'),
'5.0.4' => Array ('Core' => '5.0.4'),
'5.1.0-B1' => Array ('Core' => '5.1.0-B1'),
'5.1.0-B2' => Array ('Core' => '5.1.0-B2'),
'5.1.0-RC1' => Array ('Core' => '5.1.0-RC1'),
'5.1.0' => Array ('Core' => '5.1.0'),
'5.1.1-B1' => Array ('Core' => '5.1.1-B1'),
'5.1.1-B2' => Array ('Core' => '5.1.1-B2'),
'5.1.1-RC1' => Array ('Core' => '5.1.1-RC1'),
'5.1.1' => Array ('Core' => '5.1.1'),
'5.1.2-B1' => Array ('Core' => '5.1.2-B1'),
'5.1.2-B2' => Array ('Core' => '5.1.2-B2'),
'5.1.2-RC1' => Array ('Core' => '5.1.2-RC1'),
'5.1.2' => Array ('Core' => '5.1.2'),
'5.1.3-B1' => Array ('Core' => '5.1.3-B1'),
'5.1.3-B2' => Array ('Core' => '5.1.3-B2'),
'5.1.3-RC1' => Array ('Core' => '5.1.3-RC1'),
'5.1.3-RC2' => Array ('Core' => '5.1.3-RC2'),
'5.1.3' => Array ('Core' => '5.1.3'),
'5.2.0-B1' => Array ('Core' => '5.2.0-B1'),
'5.2.0-B2' => Array ('Core' => '5.2.0-B2'),
'5.2.0-B3' => Array ('Core' => '5.2.0-B3'),
'5.2.0-RC1' => Array ('Core' => '5.2.0-RC1'),
'5.2.0' => Array ('Core' => '5.2.0'),
'5.2.1-B1' => Array ('Core' => '5.2.1-B1'),
+ '5.2.1-B2' => Array ('Core' => '5.2.1-B2'),
+ '5.2.1-RC1' => Array ('Core' => '5.2.1-RC1'),
);
}
/**
* Changes table structure, where multilingual fields of TEXT type are present
*
* @param string $mode when called mode {before, after)
*/
function Upgrade_5_0_0($mode)
{
if ($mode == 'after') {
// update icon
$categories_config = $this->Application->getUnitConfig('c');
$root_category = $this->Application->findModule('Name', 'In-Commerce', 'RootCat');
$sql = 'UPDATE ' . $categories_config->getTableName() . '
SET UseMenuIconUrl = 1, MenuIconUrl = "in-commerce/img/menu_products.gif"
WHERE ' . $categories_config->getIDField() . ' = ' . $root_category;
$this->Conn->Query($sql);
$this->_updateDetailTemplate('p', 'in-commerce/product/details', 'in-commerce/designs/detail');
// copy store name to company name
$store_name = $this->Application->ConfigValue('Comm_StoreName');
$sql = 'UPDATE ' . TABLE_PREFIX . 'ConfigurationValues
SET VariableValue = ' . $this->Conn->qstr($store_name) . '
WHERE VariableName = "Comm_CompanyName"';
$this->Conn->Query($sql);
}
}
/**
* Update to 5.0.1, update details template
*
* @param string $mode when called mode {before, after)
*/
function Upgrade_5_0_1($mode)
{
if ($mode == 'after') {
$this->_updateDetailTemplate('p', 'in-commerce/designs/detail', 'in-commerce/products/product_detail');
// clean incomplete orders 5+ hours old
// don't use ORDER_STATUS_INCOMPLETE constant, since it's not available upgrade
$delete_timestamp = time() - (3600 * 5);
$sql = 'SELECT OrderId FROM ' . TABLE_PREFIX . 'Orders
WHERE Status = ' . 0 . '
AND OrderDate < ' . $delete_timestamp;
$orders_to_delete = $this->Conn->GetCol($sql);
if ( $orders_to_delete && is_array($orders_to_delete) ) {
$this->Conn->Query( 'DELETE FROM ' . TABLE_PREFIX . 'OrderItems
WHERE OrderId IN ( ' . implode(',', $orders_to_delete) . ' )' );
$this->Conn->Query( 'DELETE FROM ' . TABLE_PREFIX . 'Orders
WHERE Status = ' . 0 . '
AND OrderDate < ' . $delete_timestamp );
}
// delete old events
$events_to_delete = Array ( 'SITE.SUGGEST' );
$sql = 'SELECT EventId FROM ' . TABLE_PREFIX . 'Events
WHERE Event IN ("' . implode('","', $events_to_delete) . '")';
$event_ids = $this->Conn->GetCol($sql);
if ($event_ids) {
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'EmailMessage
WHERE EventId IN (' . implode(',', $event_ids) . ')';
$this->Conn->Query($sql);
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'Events
WHERE EventId IN (' . implode(',', $event_ids) . ')';
$this->Conn->Query($sql);
$sql = 'DELETE FROM ' . TABLE_PREFIX . 'Phrase
WHERE Phrase IN ("la_event_user.suggest_site")';
$this->Conn->Query($sql);
}
}
}
/**
* Update to 5.2.0-RC1
*
* @param string $mode when called mode {before, after)
*/
public function Upgrade_5_2_0_RC1($mode)
{
if ( $mode != 'before' ) {
return;
}
$table_name = $this->Application->getUnitConfig('pt')->getTableName();
$table_structure = $this->Conn->Query('DESCRIBE ' . $table_name, 'Field');
if ( isset($table_structure['Description']) ) {
$sql = 'UPDATE ' . $table_name . '
SET Description = ""
WHERE Description IS NULL';
$this->Conn->Query($sql);
$sql = 'ALTER TABLE ' . $table_name . '
CHANGE `Description` `Description` VARCHAR(255) NOT NULL DEFAULT ""';
$this->Conn->Query($sql);
}
$ml_helper = $this->Application->recallObject('kMultiLanguageHelper');
/* @var $ml_helper kMultiLanguageHelper */
$ml_helper->createFields('pt');
if ( isset($table_structure['Description']) ) {
$sql = 'UPDATE ' . $table_name . '
SET
l' . $this->Application->GetDefaultLanguageId() . '_Description = Description,
l' . $this->Application->GetDefaultLanguageId() . '_Instructions = Instructions';
$this->Conn->Query($sql);
$sql = 'ALTER TABLE ' . $table_name . ' DROP Description, DROP Instructions';
$this->Conn->Query($sql);
}
}
}
\ No newline at end of file
Index: branches/5.3.x/install/upgrades.sql
===================================================================
--- branches/5.3.x/install/upgrades.sql (revision 15898)
+++ branches/5.3.x/install/upgrades.sql (revision 15899)
@@ -1,288 +1,295 @@
# ===== v 4.3.9 =====
INSERT INTO ImportScripts VALUES (DEFAULT, 'Products from CSV file [In-Commerce]', '', 'p', 'In-Commerce', '', 'CSV', '1');
ALTER TABLE Products ADD OnSale TINYINT(1) NOT NULL default '0' AFTER Featured, ADD INDEX (OnSale);
UPDATE Phrase SET Module = 'In-Commerce' WHERE Phrase IN ('lu_comm_Images', 'lu_comm_ImagesHeader');
# ===== v 5.0.0 =====
UPDATE Category SET Template = '/in-commerce/designs/section' WHERE Template = 'in-commerce/store/category';
UPDATE Category SET CachedTemplate = '/in-commerce/designs/section' WHERE CachedTemplate = 'in-commerce/store/category';
UPDATE ConfigurationValues SET VariableValue = '/in-commerce/designs/section' WHERE VariableName = 'p_CategoryTemplate';
UPDATE ConfigurationValues SET VariableValue = 'in-commerce/designs/detail' WHERE VariableName = 'p_ItemTemplate';
DELETE FROM PersistantSessionData WHERE VariableName IN ('affil_columns_.', 'ap_columns_.', 'apayments_columns_.', 'apayments.log_columns_.', 'd_columns_.', 'coup_columns_.', 'file_columns_.', 'po_columns_.', 'z_columns_.', 'tax_columns_.');
DELETE FROM PersistantSessionData WHERE VariableName LIKE '%ord.%';
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:products.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:setting_folder.view', 11, 1, 1, 0);
INSERT INTO ShippingQuoteEngines VALUES (DEFAULT, 'USPS.com', 0, 0, 0, 'a:21:{s:12:"AccountLogin";s:0:"";s:15:"AccountPassword";N;s:10:"UPSEnabled";N;s:10:"UPSAccount";s:0:"";s:11:"UPSInvoiced";N;s:10:"FDXEnabled";N;s:10:"FDXAccount";s:0:"";s:10:"DHLEnabled";N;s:10:"DHLAccount";s:0:"";s:11:"DHLInvoiced";N;s:10:"USPEnabled";N;s:10:"USPAccount";s:0:"";s:11:"USPInvoiced";N;s:10:"ARBEnabled";N;s:10:"ARBAccount";s:0:"";s:11:"ARBInvoiced";N;s:10:"1DYEnabled";N;s:10:"2DYEnabled";N;s:10:"3DYEnabled";N;s:10:"GNDEnabled";N;s:10:"ShipMethod";N;}', 'USPS');
INSERT INTO ConfigurationAdmin VALUES ('Comm_CompanyName', 'la_Text_ContactsGeneral', 'la_text_CompanyName', 'text', NULL, NULL, 10.01, 0, 0);
INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Comm_CompanyName', '', 'In-Commerce', 'in-commerce:contacts');
UPDATE ConfigurationAdmin SET prompt = 'la_text_StoreName', DisplayOrder = 10.02 WHERE VariableName = 'Comm_StoreName';
INSERT INTO ConfigurationAdmin VALUES ('Comm_Contacts_Name', 'la_Text_ContactsGeneral', 'la_text_ContactName', 'text', NULL, NULL, 10.03, 0, 0);
INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Comm_Contacts_Name', '', 'In-Commerce', 'in-commerce:contacts');
UPDATE ConfigurationAdmin SET DisplayOrder = 10.04 WHERE VariableName = 'Comm_Contacts_Phone';
UPDATE ConfigurationAdmin SET DisplayOrder = 10.05 WHERE VariableName = 'Comm_Contacts_Fax';
UPDATE ConfigurationAdmin SET DisplayOrder = 10.06 WHERE VariableName = 'Comm_Contacts_Email';
UPDATE ConfigurationAdmin SET DisplayOrder = 10.07 WHERE VariableName = 'Comm_Contacts_Additional';
DELETE FROM Phrase WHERE Phrase IN ('la_fld_ManufacturerId', 'la_fld_DiscountId', 'la_fld_CouponId', 'la_fld_AffiliatePlanId', 'la_fld_AffiliateId', 'la_fld_ZoneId', 'la_fld_EngineId', 'la_fld_ShippingId', 'la_fld_ProductId', 'la_fld_OptionId', 'la_fld_CurrencyId', 'la_fld_Zone_Name');
UPDATE Phrase SET Module = 'In-Commerce' WHERE ((Phrase LIKE '%Product%' OR Phrase LIKE '%Shipping%' OR Phrase LIKE '%Coupon%' OR Phrase LIKE '%Discount%' OR Phrase LIKE '%Report%' OR Phrase LIKE '%Currency%' OR Phrase LIKE '%Cart%') AND (Module = 'Core'));
# ===== v 5.0.1 =====
UPDATE ConfigurationValues SET VariableValue = 'in-commerce/products/product_detail' WHERE VariableName = 'p_ItemTemplate';
UPDATE ConfigurationAdmin SET ValueList = '1=la_opt_Session,2=la_opt_PermanentCookie' WHERE VariableName = 'Comm_AffiliateStorageMethod';
UPDATE ConfigurationAdmin SET ValueList = 'ASC=la_common_Ascending,DESC=la_common_Descending'
WHERE VariableName IN ('product_OrderProductsByDir', 'product_OrderProductsThenByDir');
UPDATE ConfigurationAdmin SET ValueList = '1=la_opt_PriceCalculationByPrimary,2=la_opt_PriceCalculationByOptimal'
WHERE VariableName = 'Comm_PriceBracketCalculation';
UPDATE ConfigurationAdmin
SET ValueList = '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year'
WHERE VariableName IN ('product_ReviewDelay_Interval', 'product_RatingDelay_Interval');
UPDATE CustomField SET FieldLabel = 'la_fld_cust_p_ItemTemplate', Prompt = 'la_fld_cust_p_ItemTemplate' WHERE FieldName = 'p_ItemTemplate';
UPDATE Events SET Type = 1 WHERE Event = 'BACKORDER.FULLFILL';
UPDATE ConfigurationAdmin SET ValueList = 'style="width: 50px;"' WHERE VariableName IN ('product_RatingDelay_Value', 'product_ReviewDelay_Value');
# ===== v 5.0.2-B1 =====
ALTER TABLE AffiliatePayments
CHANGE Comment Comment text NULL,
CHANGE PaymentDate PaymentDate INT(10) UNSIGNED NULL DEFAULT NULL;
ALTER TABLE AffiliatePaymentTypes CHANGE Description Description text NULL;
ALTER TABLE Affiliates
CHANGE Comments Comments text NULL,
CHANGE CreatedOn CreatedOn INT(11) NULL DEFAULT NULL;
ALTER TABLE Manufacturers CHANGE Description Description text NULL;
ALTER TABLE Orders
CHANGE UserComment UserComment text NULL,
CHANGE AdminComment AdminComment text NULL,
CHANGE GWResult1 GWResult1 MEDIUMTEXT NULL,
CHANGE GWResult2 GWResult2 MEDIUMTEXT NULL,
CHANGE OrderDate OrderDate INT(10) UNSIGNED NULL DEFAULT NULL,
CHANGE PaymentExpires PaymentExpires INT(10) UNSIGNED NULL DEFAULT NULL;
ALTER TABLE PaymentTypes CHANGE PortalGroups PortalGroups text NULL;
ALTER TABLE ProductOptionCombinations CHANGE Combination Combination text NULL;
ALTER TABLE Products
CHANGE ShippingLimitation ShippingLimitation text NULL,
CHANGE PackageContent PackageContent MEDIUMTEXT NULL;
ALTER TABLE ShippingQuoteEngines CHANGE Properties Properties text NULL;
ALTER TABLE ShippingType CHANGE PortalGroups PortalGroups text NULL;
ALTER TABLE ProductFiles
CHANGE ProductId ProductId INT(11) NOT NULL DEFAULT '0',
CHANGE `Name` `Name` VARCHAR(255) NOT NULL DEFAULT '',
CHANGE Version Version VARCHAR(100) NOT NULL DEFAULT '',
CHANGE FilePath FilePath VARCHAR(255) NOT NULL DEFAULT '',
CHANGE RealPath RealPath VARCHAR(255) NOT NULL DEFAULT '',
CHANGE Size Size INT(11) NOT NULL DEFAULT '0',
CHANGE AddedOn AddedOn INT(11) NULL DEFAULT NULL;
ALTER TABLE UserFileAccess
CHANGE ProductId ProductId INT( 11 ) NOT NULL DEFAULT '0',
CHANGE PortalUserId PortalUserId INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE GatewayConfigFields CHANGE ValueList ValueList MEDIUMTEXT NULL;
ALTER TABLE Currencies
CHANGE `Status` `Status` SMALLINT(6) NOT NULL DEFAULT '1',
CHANGE Modified Modified INT(11) NULL DEFAULT NULL;
ALTER TABLE GiftCertificates CHANGE `Status` `Status` TINYINT(1) NOT NULL DEFAULT '2';
ALTER TABLE UserDownloads
CHANGE StartedOn StartedOn INT(11) NULL DEFAULT NULL,
CHANGE EndedOn EndedOn INT(11) NULL DEFAULT NULL;
# ===== v 5.0.2-B2 =====
# ===== v 5.0.2-RC1 =====
# ===== v 5.0.2 =====
# ===== v 5.0.3-B1 =====
UPDATE Phrase
SET PhraseType = 1
WHERE Phrase IN (
'la_ship_All_Together', 'la_ship_Backorders_Upon_Avail', 'la_ship_Backorder_Separately',
'lu_ship_Shipment', 'lu_ship_ShippingType'
);
# ===== v 5.0.3-B2 =====
# ===== v 5.0.3-RC1 =====
# ===== v 5.0.3 =====
# ===== v 5.0.4-B1 =====
# ===== v 5.0.4-B2 =====
# ===== v 5.0.4 =====
# ===== v 5.1.0-B1 =====
UPDATE Modules SET Path = 'modules/in-commerce/' WHERE `Name` = 'In-Commerce';
UPDATE ConfigurationValues
SET ValueList = '0=lu_none||<SQL+>SELECT l%3$s_Name AS OptionName, IsoCode AS OptionValue FROM <PREFIX>CountryStates WHERE Type = 1 ORDER BY OptionName</SQL>'
WHERE ValueList = '0=lu_none||<SQL>SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM <PREFIX>StdDestinations WHERE DestParentId IS NULL Order BY OptionName</SQL>';
ALTER TABLE SiteDomains
ADD COLUMN BillingCountry varchar(3) NOT NULL DEFAULT '',
ADD COLUMN ShippingCountry varchar(3) NOT NULL DEFAULT '',
ADD COLUMN PrimaryCurrencyId int(11) NOT NULL DEFAULT '0',
ADD COLUMN Currencies varchar(255) NOT NULL DEFAULT '',
ADD COLUMN PrimaryPaymentTypeId int(11) NOT NULL DEFAULT '0',
ADD COLUMN PaymentTypes varchar(255) NOT NULL DEFAULT '',
ADD INDEX (BillingCountry),
ADD INDEX (ShippingCountry),
ADD INDEX (PrimaryCurrencyId),
ADD INDEX (Currencies),
ADD INDEX (PrimaryPaymentTypeId),
ADD INDEX (PaymentTypes);
UPDATE Phrase SET Module = 'Core' WHERE Phrase IN ('la_btn_Add', 'la_fld_RecipientName', 'la_fld_SenderName');
DELETE FROM Permissions WHERE Permission LIKE 'in-commerce:incommerce_configemail%';
# ===== v 5.1.0-B2 =====
# ===== v 5.1.0-RC1 =====
UPDATE Phrase
SET PhraseType = 1
WHERE Phrase IN (
'la_col_Qty', 'la_col_QtyBackordered', 'la_ItemBackordered', 'la_ship_all_together',
'la_ship_backorders_upon_avail', 'la_ship_backorder_separately', 'la_tooltip_New_Coupon',
'la_tooltip_New_Discount'
);
DELETE FROM Phrase WHERE Phrase = 'la_comm_ProductsByManuf';
# ===== v 5.1.0 =====
ALTER TABLE Products CHANGE CachedRating CachedRating varchar(10) NOT NULL default '0';
# ===== v 5.1.1-B1 =====
ALTER TABLE Orders CHANGE ShippingOption ShippingOption TINYINT(4) NOT NULL DEFAULT '0';
ALTER TABLE ProductFiles CHANGE AddedById AddedById INT(11) NULL DEFAULT NULL;
UPDATE ProductFiles SET AddedById = NULL WHERE AddedById = 0;
ALTER TABLE Products
CHANGE CreatedById CreatedById INT(11) NULL DEFAULT NULL ,
CHANGE ModifiedById ModifiedById INT(11) NULL DEFAULT NULL;
UPDATE Products SET CreatedById = NULL WHERE CreatedById = 0;
UPDATE Products SET ModifiedById = NULL WHERE ModifiedById = 0;
# ===== v 5.1.1-B2 =====
# ===== v 5.1.1-RC1 =====
# ===== v 5.1.1 =====
# ===== v 5.1.2-B1 =====
DELETE FROM Phrase WHERE PhraseKey = 'LA_TITLE_ADDING_ORDER_ITEM';
# ===== v 5.1.2-B2 =====
UPDATE Phrase SET l<%PRIMARY_LANGUAGE%>_Translation = REPLACE(l<%PRIMARY_LANGUAGE%>_Translation, 'Discounts & Coupons', 'Discounts & Certificates') WHERE PhraseKey = 'LA_TAB_DISCOUNTSANDCOUPONS';
# ===== v 5.1.2-RC1 =====
UPDATE Phrase SET Module = 'Core' WHERE PhraseKey = 'LA_FLD_ISOCODE' OR PhraseKey = 'LA_COL_ISOCODE';
# ===== v 5.1.2 =====
# ===== v 5.1.3-B1 =====
ALTER TABLE AffiliatePlansBrackets CHANGE Percent Percent DECIMAL (10,2) NOT NULL DEFAULT '0.00';
# ===== v 5.1.3-B2 =====
# ===== v 5.1.3-RC1 =====
UPDATE ConfigurationValues
SET VariableValue = 'in-commerce/products/product_detail'
WHERE VariableName = 'p_ItemTemplate' AND VariableValue = 'in-commerce/designs/detail';
# ===== v 5.1.3-RC2 =====
# ===== v 5.1.3 =====
# ===== v 5.2.0-B1 =====
UPDATE SearchConfig
SET DisplayName = REPLACE(DisplayName, 'lu_', 'lc_')
WHERE DisplayName IN ('lu_field_descriptionex', 'lu_field_manufacturer', 'lu_field_qtysold', 'lu_field_topseller');
INSERT INTO SystemSettings VALUES(DEFAULT, 'OrderVATIncluded', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_config_OrderVATIncluded', 'checkbox', NULL, NULL, 10.12, '0', '0', NULL);
ALTER TABLE Orders ADD VATIncluded TINYINT(1) UNSIGNED NOT NULL DEFAULT '0';
INSERT INTO ItemFilters VALUES
(DEFAULT, 'p', 'ManufacturerId', 'checkbox', 1, NULL),
(DEFAULT, 'p', 'Price', 'range', 1, 11),
(DEFAULT, 'p', 'EditorsPick', 'radio', 1, NULL);
DELETE FROM LanguageLabels WHERE PhraseKey = 'LA_COL_ITEMNAME';
DELETE FROM LanguageLabels
WHERE PhraseKey IN ('LA_ALLOWORDERINGINNONPRIMARYCURRENCY', 'LA_ALLOWORDERDIFFERENTTYPES');
DELETE FROM SystemSettings
WHERE VariableName IN ('Comm_AllowOrderingInNonPrimaryCurrency', 'Comm_Allow_Order_Different_Types');
UPDATE SystemSettings
SET DisplayOrder = 20.01
WHERE VariableName = 'Comm_ExchangeRateSource';
UPDATE SystemSettings
SET DisplayOrder = DisplayOrder - 0.01
WHERE VariableName IN (
'Comm_Enable_Backordering', 'Comm_Process_Backorders_Auto', 'Comm_Next_Order_Number', 'Comm_Order_Number_Format_P',
'Comm_Order_Number_Format_S', 'Comm_RecurringChargeInverval', 'Comm_AutoProcessRecurringOrders', 'MaxAddresses',
'Comm_MaskProcessedCreditCards', 'OrderVATIncluded'
);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxCompareProducts', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_config_MaxCompareProducts', 'text', NULL, NULL, 10.12, 0, 1, NULL);
# ===== v 5.2.0-B2 =====
UPDATE Products main_table
SET main_table.CachedReviewsQty = (SELECT COUNT(*) FROM <%TABLE_PREFIX%>CatalogReviews review_table WHERE review_table.ItemId = main_table.ResourceId);
# ===== v 5.2.0-B3 =====
ALTER TABLE OrderItems CHANGE OptionsSalt OptionsSalt BIGINT(11) NULL DEFAULT '0';
UPDATE OrderItems
SET OptionsSalt = CAST((OptionsSalt & 0xFFFFFFFF) AS UNSIGNED INTEGER)
WHERE OptionsSalt < 0;
ALTER TABLE ProductOptionCombinations CHANGE CombinationCRC CombinationCRC BIGINT(11) NOT NULL DEFAULT '0';
UPDATE ProductOptionCombinations
SET CombinationCRC = CAST((CombinationCRC & 0xFFFFFFFF) AS UNSIGNED INTEGER)
WHERE CombinationCRC < 0;
# ===== v 5.2.0-RC1 =====
DELETE FROM Currencies WHERE ISO = 'NZD' LIMIT 1;
# ===== v 5.2.0 =====
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:general.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:output.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES(DEFAULT, 'in-commerce:contacts.add', 11, 1, 1, 0);
# ===== v 5.2.1-B1 =====
ALTER TABLE Affiliates CHANGE PortalUserId PortalUserId INT(10) NULL DEFAULT NULL;
UPDATE Affiliates SET PortalUserId = NULL WHERE PortalUserId = 0;
+
+# ===== v 5.2.1-B2 =====
+UPDATE Modules
+SET ClassNamespace = 'Intechnic\\InPortal\\Modules\\InCommerce'
+WHERE `Name` = 'In-Commerce';
+
+# ===== v 5.2.1-RC1 =====
Index: branches/5.3.x/install/english.lang
===================================================================
--- branches/5.3.x/install/english.lang (revision 15898)
+++ branches/5.3.x/install/english.lang (revision 15899)
@@ -1,1045 +1,1048 @@
-<LANGUAGES Version="5">
- <LANGUAGE Encoding="base64" PackName="English" LocalName="English" DateFormat="m/d/Y" TimeFormat="g:i A" InputDateFormat="m/d/Y" InputTimeFormat="g:i:s A" DecimalPoint="." ThousandSep="," Charset="utf-8" UnitSystem="2" Locale="en-US" UserDocsUrl="http://docs.in-portal.org/eng/index.php">
+<?xml version="1.0" encoding="utf-8"?>
+<LANGUAGES Version="6">
+ <LANGUAGE Encoding="base64" PackName="English" LocalName="English" DateFormat="m/d/Y" ShortDateFormat="m/d" TimeFormat="g:i A" ShortTimeFormat="g:i A" InputDateFormat="m/d/Y" InputTimeFormat="g:i:s A" DecimalPoint="." ThousandSep="," UnitSystem="2" Locale="en-US" UserDocsUrl="http://docs.in-portal.org/eng/index.php">
+ <EMAILDESIGNS>
+ <HTML>JGJvZHkNCjxici8+PGJyLz4NCg0KU2luY2VyZWx5LDxici8+PGJyLz4NCg0KV2Vic2l0ZSBhZG1pbmlzdHJhdGlvbi4NCg0KPCEtLSMjIDxpbnAyOmVtYWlsLWxvZ19JdGVtTGluayB0ZW1wbGF0ZT0icGxhdGZvcm0vbXlfYWNjb3VudC9lbWFpbCIvPiAjIy0tPg==</HTML>
+ </EMAILDESIGNS>
<PHRASES>
<PHRASE Label="la_AccountLogin" Module="In-Commerce" Type="1">QWNjb3VudA==</PHRASE>
<PHRASE Label="la_AddressLine1" Module="In-Commerce" Type="1">QWRkcmVzcyBMaW5lIDE=</PHRASE>
<PHRASE Label="la_AddressLine2" Module="In-Commerce" Type="1">QWRkcmVzcyBMaW5lIDI=</PHRASE>
<PHRASE Label="la_ADP" Module="In-Commerce" Type="1">QW5kb3JyYW4gUGVzZXRh</PHRASE>
<PHRASE Label="la_AED" Module="In-Commerce" Type="1">VUFFIERpcmhhbQ==</PHRASE>
<PHRASE Label="la_AFA" Module="In-Commerce" Type="1">QWZnaGFuaQ==</PHRASE>
<PHRASE Label="la_affiliate_already_exists" Module="In-Commerce" Type="1">YWZmaWxpYXRlIGFscmVhZHkgZXhpc3Rz</PHRASE>
<PHRASE Label="la_AFN" Module="In-Commerce" Type="1">QWZnaGFuaQ==</PHRASE>
<PHRASE Label="la_ALL" Module="In-Commerce" Type="1">TGVjaw==</PHRASE>
<PHRASE Label="la_Allowed" Module="In-Commerce" Type="1">QWxsb3dlZA==</PHRASE>
<PHRASE Label="la_AllowOrderMoreThanAvailable" Module="In-Commerce" Type="1">QWxsb3cgb3JkZXJpbmcgb2YgbW9yZSBxdWFudGl0eSB0aGFuIGF2YWlsYWJsZSBhcyBiYWNrb3JkZXI=</PHRASE>
<PHRASE Label="la_AMD" Module="In-Commerce" Type="1">QXJtZW5pYW4gRHJhbQ==</PHRASE>
<PHRASE Label="la_ANG" Module="In-Commerce" Type="1">TmV0aGVybGFuZHMgQW50aWxsYW4gR3VpbGRlcg==</PHRASE>
<PHRASE Label="la_AOA" Module="In-Commerce" Type="1">S3dhbnph</PHRASE>
<PHRASE Label="la_Archived" Module="In-Commerce" Type="1">QXJjaGl2ZWQ=</PHRASE>
<PHRASE Label="la_ARS" Module="In-Commerce" Type="1">QXJnZW50aW5lIFBlc28=</PHRASE>
<PHRASE Label="la_AUD" Module="In-Commerce" Type="1">QXVzdHJhbGlhbiBEb2xsYXI=</PHRASE>
<PHRASE Label="la_AutoBackorder" Module="In-Commerce" Type="1">QXV0byBCYWNrb3JkZXI=</PHRASE>
<PHRASE Label="la_AutoProcessRecurringOrders" Module="In-Commerce" Type="1">QXV0b21hdGljYWxseSBQcm9jZXNzIFJlY3VycmluZyBPcmRlcnM=</PHRASE>
<PHRASE Label="la_Availability" Module="In-Commerce" Type="1">QXZhaWxhYmlsaXR5</PHRASE>
<PHRASE Label="la_AWG" Module="In-Commerce" Type="1">QXJ1YmFuIEd1aWxkZXI=</PHRASE>
<PHRASE Label="la_AZM" Module="In-Commerce" Type="1">QXplcmJhaWphbmlhbiBNYW5hdA==</PHRASE>
<PHRASE Label="la_BackOrders" Module="In-Commerce" Type="1">QmFja09yZGVycw==</PHRASE>
<PHRASE Label="la_BAM" Module="In-Commerce" Type="1">Q29udmVydGlibGUgTWFya3M=</PHRASE>
<PHRASE Label="la_BankOfLatvia" Module="In-Commerce" Type="1">QmFuayBvZiBMYXR2aWEgLSB3d3cuYmFuay5sdg==</PHRASE>
<PHRASE Label="la_Base_Fee" Module="In-Commerce" Type="1">QmFzZSBGZWU=</PHRASE>
<PHRASE Label="la_BBD" Module="In-Commerce" Type="1">QmFyYmFkb3MgRG9sbGFy</PHRASE>
<PHRASE Label="la_BDT" Module="In-Commerce" Type="1">VGFrYQ==</PHRASE>
<PHRASE Label="la_BGL" Module="In-Commerce" Type="1">TGV2</PHRASE>
<PHRASE Label="la_BGN" Module="In-Commerce" Type="1">QnVsZ2FyaWFuIExldg==</PHRASE>
<PHRASE Label="la_BHD" Module="In-Commerce" Type="1">QmFocmFpbmkgRGluYXI=</PHRASE>
<PHRASE Label="la_BIF" Module="In-Commerce" Type="1">QnVydW5kaSBGcmFuYw==</PHRASE>
<PHRASE Label="la_BMD" Module="In-Commerce" Type="1">QmVybXVkaWFuIERvbGxhcg==</PHRASE>
<PHRASE Label="la_BND" Module="In-Commerce" Type="1">QnJ1bmVpIERvbGxhcg==</PHRASE>
<PHRASE Label="la_BOB" Module="In-Commerce" Type="1">Qm9saXZpYW5v</PHRASE>
<PHRASE Label="la_BOV" Module="In-Commerce" Type="1">TXZkb2w=</PHRASE>
<PHRASE Label="la_BRL" Module="In-Commerce" Type="1">QnJhemlsaWFuIFJlYWw=</PHRASE>
<PHRASE Label="la_BSD" Module="In-Commerce" Type="1">QmFoYW1pYW4gRG9sbGFy</PHRASE>
<PHRASE Label="la_BTN" Module="In-Commerce" Type="1">Tmd1bHRydW0=</PHRASE>
<PHRASE Label="la_btn_AddLocation" Module="In-Commerce" Type="1">QWRkIExvY2F0aW9u</PHRASE>
<PHRASE Label="la_btn_CancelOrder" Module="In-Commerce" Type="1">Q2FuY2VsIE9yZGVy</PHRASE>
<PHRASE Label="la_btn_Order" Module="In-Commerce" Type="1">T3JkZXI=</PHRASE>
<PHRASE Label="la_btn_ReceiveOrder" Module="In-Commerce" Type="1">UmVjZWl2ZSBPcmRlcg==</PHRASE>
<PHRASE Label="la_btn_Remove" Module="In-Commerce" Type="1">UmVtb3Zl</PHRASE>
<PHRASE Label="la_btn_RemoveLocations" Module="In-Commerce" Type="1">UmVtb3ZlIExvY2F0aW9ucw==</PHRASE>
<PHRASE Label="la_BuiltIn" Module="In-Commerce" Type="1">QnVpbHQtSW4=</PHRASE>
<PHRASE Label="la_button_add" Module="In-Commerce" Type="1">QWRk</PHRASE>
<PHRASE Label="la_button_receive_order" Module="In-Commerce" Type="1">UmVjZWl2ZSBvcmRlcg==</PHRASE>
<PHRASE Label="la_button_remove" Module="In-Commerce" Type="1">UmVtb3Zl</PHRASE>
<PHRASE Label="la_Button_Save" Module="In-Commerce" Type="1">U2F2ZQ==</PHRASE>
<PHRASE Label="la_BWP" Module="In-Commerce" Type="1">UHVsYQ==</PHRASE>
<PHRASE Label="la_ByAmount" Module="In-Commerce" Type="1">YnkgYW1vdW50</PHRASE>
<PHRASE Label="la_ByCategory" Module="In-Commerce" Type="1">QnkgU2VjdGlvbg==</PHRASE>
<PHRASE Label="la_ByCountry" Module="In-Commerce" Type="1">QnkgQ291bnRyeQ==</PHRASE>
<PHRASE Label="la_ByItem" Module="In-Commerce" Type="1">YnkgaXRlbQ==</PHRASE>
<PHRASE Label="la_byProduct" Module="In-Commerce" Type="1">QnkgUHJvZHVjdA==</PHRASE>
<PHRASE Label="la_BYR" Module="In-Commerce" Type="1">QmVsYXJ1c3NpYW4gUnVibGU=</PHRASE>
<PHRASE Label="la_ByState" Module="In-Commerce" Type="1">QnkgU3RhdGU=</PHRASE>
<PHRASE Label="la_ByUser" Module="In-Commerce" Type="1">QnkgVXNlcg==</PHRASE>
<PHRASE Label="la_ByWeight" Module="In-Commerce" Type="1">Ynkgd2VpZ2h0</PHRASE>
<PHRASE Label="la_ByZIP" Module="In-Commerce" Type="1">QnkgWklQ</PHRASE>
<PHRASE Label="la_by_amount" Module="In-Commerce" Type="1">YnkgYW1vdW50</PHRASE>
<PHRASE Label="la_by_items_sold" Module="In-Commerce" Type="1">YnkgaXRlbXMgc29sZA==</PHRASE>
<PHRASE Label="la_by_options" Module="In-Commerce" Type="1">QnkgUHJvZHVjdCBPcHRpb25z</PHRASE>
<PHRASE Label="la_by_product" Module="In-Commerce" Type="1">QnkgUHJvZHVjdA==</PHRASE>
<PHRASE Label="la_by_request" Module="In-Commerce" Type="1">QnkgUmVxdWVzdA==</PHRASE>
<PHRASE Label="la_BZD" Module="In-Commerce" Type="1">QmVsaXplIERvbGxhcg==</PHRASE>
<PHRASE Label="la_CAD" Module="In-Commerce" Type="1">Q2FuYWRpYW4gRG9sbGFy</PHRASE>
<PHRASE Label="la_CDF" Module="In-Commerce" Type="1">RnJhbmMgQ29uZ29sYWlz</PHRASE>
<PHRASE Label="la_CHF" Module="In-Commerce" Type="1">U3dpc3MgRnJhbmM=</PHRASE>
<PHRASE Label="la_City" Module="In-Commerce" Type="1">Q2l0eQ==</PHRASE>
<PHRASE Label="la_ClearCostsWarning" Module="In-Commerce" Type="1">RG8geW91IHJlYWxseSB3YW50IHRvIHJlc2V0IHdob2xlIGNvc3RzIHRhYmxlPw==</PHRASE>
<PHRASE Label="la_CLF" Module="In-Commerce" Type="1">VW5pZGFkZXMgZGUgZm9tZW50bw==</PHRASE>
<PHRASE Label="la_CloneCoupon" Module="In-Commerce" Type="1">Q2xvbmluZyBhIENvdXBvbg==</PHRASE>
<PHRASE Label="la_CLP" Module="In-Commerce" Type="1">Q2hpbGVhbiBQZXNv</PHRASE>
<PHRASE Label="la_CNY" Module="In-Commerce" Type="1">Q2hpbmEgWXVhbiBSZW5taW5iaQ==</PHRASE>
<PHRASE Label="la_COD" Module="In-Commerce" Type="1">Q09E</PHRASE>
<PHRASE Label="la_COD_Flat_Surcharge" Module="In-Commerce" Type="1">Q09EIEZsYXQgU3VyY2hhcmdl</PHRASE>
<PHRASE Label="la_COD_Percent_Surcharge" Module="In-Commerce" Type="1">Q09EIFBlcmNlbnQgU3VyY2hhcmdl</PHRASE>
<PHRASE Label="la_col_BuiltIn" Module="In-Commerce" Type="1">QnVpbHQtSW4=</PHRASE>
<PHRASE Label="la_col_CODFlatSurecharge" Module="In-Commerce" Type="1">Q09EIGZsYXQgc3VyZWNoYXJnZQ==</PHRASE>
<PHRASE Label="la_col_Combination" Module="In-Commerce" Type="1">Q29tYmluYXRpb24=</PHRASE>
<PHRASE Label="la_col_Commission" Module="In-Commerce" Type="1">QWZmaWxsaWF0ZSBDb21taXNzaW9u</PHRASE>
<PHRASE Label="la_col_CouponItemType" Module="In-Commerce" Type="1">Q291cG9uIEl0ZW0gVHlwZQ==</PHRASE>
<PHRASE Label="la_col_CustomerName" Module="In-Commerce" Type="1">Q3VzdG9tZXIgTmFtZQ==</PHRASE>
<PHRASE Label="la_col_DownloadedFileName" Module="In-Commerce" Type="1">RmlsZW5hbWU=</PHRASE>
<PHRASE Label="la_col_DownloadedProductName" Module="In-Commerce" Type="1">UHJvZHVjdCBOYW1l</PHRASE>
<PHRASE Label="la_col_EndedOn" Module="In-Commerce" Type="1">RW5kZWQgT24=</PHRASE>
<PHRASE Label="la_col_ExtendedPrice" Module="In-Commerce" Type="1">RXh0LiBQcmljZQ==</PHRASE>
<PHRASE Label="la_col_FromUser" Module="In-Commerce" Type="1">RnJvbSBVc2Vy</PHRASE>
<PHRASE Label="la_col_GMV" Module="In-Commerce" Type="1">R01W</PHRASE>
<PHRASE Label="la_col_ItemType" Module="In-Commerce" Type="1">RGlzY291bnQgSXRlbSBUeXBl</PHRASE>
<PHRASE Label="la_col_LastUpdated" Module="In-Commerce" Type="1">TGFzdCBVcGRhdGVk</PHRASE>
<PHRASE Label="la_col_ManufacturerName" Module="In-Commerce" Type="1">TmFtZQ==</PHRASE>
<PHRASE Label="la_col_Marketplace" Module="In-Commerce" Type="1">TWFya2V0cGxhY2U=</PHRASE>
<PHRASE Label="la_col_OrderDate" Module="In-Commerce" Type="1">RGF0ZQ==</PHRASE>
<PHRASE Label="la_col_OrderTotal" Module="In-Commerce" Type="1">T3JkZXIgVG90YWw=</PHRASE>
<PHRASE Label="la_col_PaymentTypeName" Module="In-Commerce" Type="1">TmFtZQ==</PHRASE>
<PHRASE Label="la_col_Percent" Module="In-Commerce" Type="1">UGVyY2VudA==</PHRASE>
<PHRASE Label="la_col_PlanName" Module="In-Commerce" Type="1">UGxhbiBOYW1l</PHRASE>
<PHRASE Label="la_col_Processing" Module="In-Commerce" Type="1">UHJvY2Vzc2luZw==</PHRASE>
<PHRASE Label="la_col_Product" Module="In-Commerce" Type="1">UHJvZHVjdA==</PHRASE>
<PHRASE Label="la_col_ProductBackOrderDate" Module="In-Commerce" Type="1">QmFja09yZGVyIERhdGU=</PHRASE>
<PHRASE Label="la_col_ProductCreatedOn" Module="In-Commerce" Type="1">Q3JlYXRlZCBPbg==</PHRASE>
<PHRASE Label="la_col_ProductName" Module="In-Commerce" Type="1">TmFtZQ==</PHRASE>
<PHRASE Label="la_col_ProductNameId" Module="In-Commerce" Type="1">UHJvZHVjdCBOYW1lIChJRCk=</PHRASE>
<PHRASE Label="la_col_ProductSKU" Module="In-Commerce" Type="1">U0tV</PHRASE>
<PHRASE Label="la_col_ProductWeight" Module="In-Commerce" Type="1">V2VpZ2h0</PHRASE>
<PHRASE Label="la_col_Profit" Module="In-Commerce" Type="1">UHJvZml0</PHRASE>
<PHRASE Label="la_col_Quantity" Module="In-Commerce" Type="1">UXR5Lg==</PHRASE>
<PHRASE Label="la_col_QuantityAvailable" Module="In-Commerce" Type="1">QXZhaWwu</PHRASE>
<PHRASE Label="la_col_QuantityReserved" Module="In-Commerce" Type="1">UmVzZXJ2ZWQ=</PHRASE>
<PHRASE Label="la_col_ReturnAmount" Module="In-Commerce" Type="1">UmV0LiBBbW91bnQ=</PHRASE>
<PHRASE Label="la_col_ReturnedOn" Module="In-Commerce" Type="1">UmV0LiBEYXRl</PHRASE>
<PHRASE Label="la_col_ReturnType" Module="In-Commerce" Type="1">UmV0LiBUeXBl</PHRASE>
<PHRASE Label="la_col_Shipping" Module="In-Commerce" Type="1">U2hpcHBpbmc=</PHRASE>
<PHRASE Label="la_col_ShippingFromLocation" Module="In-Commerce" Type="1">RnJvbSBMb2NhdGlvbg==</PHRASE>
<PHRASE Label="la_col_Size" Module="In-Commerce" Type="1">U2l6ZQ==</PHRASE>
<PHRASE Label="la_col_StartedOn" Module="In-Commerce" Type="1">U3RhcnRlZCBPbg==</PHRASE>
<PHRASE Label="la_col_Tax" Module="In-Commerce" Type="1">VGF4</PHRASE>
<PHRASE Label="la_Combined" Module="In-Commerce" Type="1">Q29tYmluZWQ=</PHRASE>
<PHRASE Label="la_comment_LeaveBlank" Module="In-Commerce" Type="1">KGxlYXZlIGJsYW5rIGZvciB1bmxpbWl0ZWQp</PHRASE>
<PHRASE Label="la_comm_Any" Module="In-Commerce" Type="1">QW55</PHRASE>
<PHRASE Label="la_comm_OrderContents" Module="In-Commerce" Type="1">T3JkZXIgQ29udGVudHM=</PHRASE>
<PHRASE Label="la_comm_ShippingBillingInfo" Module="In-Commerce" Type="1">U2hpcHBpbmcgJiBCaWxsaW5nIEluZm9ybWF0aW9u</PHRASE>
<PHRASE Label="la_comm_Timeframe" Module="In-Commerce" Type="1">VGltZWZyYW1l</PHRASE>
<PHRASE Label="la_config_MaxCompareProducts" Module="In-Commerce" Type="1">TWF4aW1hbCBudW1iZXIgb2YgcHJvZHVjdHMgaW4gY29tcGFyaXNvbiBsaXN0</PHRASE>
<PHRASE Label="la_config_OrderVATIncluded" Module="In-Commerce" Type="1">VGF4ZXMgaW5jbHVkZWQgaW4gcHJvZHVjdCBwcmljZSwgc2hpcHBpbmcgY29zdCAmIHByb2Nlc3NpbmcgZmVl</PHRASE>
<PHRASE Label="la_config_ShowProductImagesInOrders" Module="In-Commerce" Type="1">U2hvdyBQcm9kdWN0IEltYWdlcyBpbiBPcmRlcnM=</PHRASE>
<PHRASE Label="la_conf_DaysToBeNew" Module="In-Commerce" Type="1">TnVtYmVyIG9mIGRheXMgZm9yIGEgcHJvZHVjdCB0byBiZSBOZXc=</PHRASE>
<PHRASE Label="la_conf_DefaultCouponDuration" Module="In-Commerce" Type="1">RGVmYXVsdCBjb3Vwb24gZHVyYXRpb24gKGRheXMp</PHRASE>
<PHRASE Label="la_conf_EditorPicksAboveRegular" Module="In-Commerce" Type="1">RGlzcGxheSBFZGl0b3IgUGlja3MgYWJvdmUgcmVndWxhciBwcm9kdWN0cw==</PHRASE>
<PHRASE Label="la_conf_OrderProductsBy" Module="In-Commerce" Type="1">T3JkZXIgcHJvZHVjdHMgYnk=</PHRASE>
<PHRASE Label="la_conf_ThenBy" Module="In-Commerce" Type="1">VGhlbiBCeQ==</PHRASE>
<PHRASE Label="la_COP" Module="In-Commerce" Type="1">Q29sb21iaWFuIFBlc28=</PHRASE>
<PHRASE Label="la_COU" Module="In-Commerce" Type="1">Q09V</PHRASE>
<PHRASE Label="la_couldnt_retrieve_rate" Module="In-Commerce" Type="1">Q291bGRuJ3QgcmV0cmlldmUgY3VycmVuY3kgcmF0ZSE=</PHRASE>
<PHRASE Label="la_Country" Module="In-Commerce" Type="1">Q291bnRyeQ==</PHRASE>
<PHRASE Label="la_CouponCode" Module="In-Commerce" Type="1">Q291cG9uIENvZGU=</PHRASE>
<PHRASE Label="la_CRC" Module="In-Commerce" Type="1">Q29zdGEgUmljYW4gQ29sb24=</PHRASE>
<PHRASE Label="la_CreditDirect" Module="In-Commerce" Type="1">Q3JlZGl0IERpcmVjdA==</PHRASE>
<PHRASE Label="la_CreditPreAuthorize" Module="In-Commerce" Type="1">Q3JlZGl0IFByZS1BdXRob3JpemU=</PHRASE>
<PHRASE Label="la_CSD" Module="In-Commerce" Type="1">Q1NE</PHRASE>
<PHRASE Label="la_CUP" Module="In-Commerce" Type="1">Q3ViYW4gUGVzbw==</PHRASE>
<PHRASE Label="la_CVE" Module="In-Commerce" Type="1">Q2FwZSBWZXJkZSBFc2N1ZG8=</PHRASE>
<PHRASE Label="la_CYP" Module="In-Commerce" Type="1">Q3lwcnVzIFBvdW5k</PHRASE>
<PHRASE Label="la_CZK" Module="In-Commerce" Type="1">Q3plY2ggS29ydW5h</PHRASE>
<PHRASE Label="la_day" Module="In-Commerce" Type="1">ZGF5</PHRASE>
<PHRASE Label="la_Denied" Module="In-Commerce" Type="1">RGVuaWVk</PHRASE>
<PHRASE Label="la_Details" Module="In-Commerce" Type="1">VmlldyBEZXRhaWxz</PHRASE>
<PHRASE Label="la_Discount" Module="In-Commerce" Type="1">RGlzY291bnQ=</PHRASE>
<PHRASE Label="la_DJF" Module="In-Commerce" Type="1">RGppYm91dGkgRnJhbmM=</PHRASE>
<PHRASE Label="la_DKK" Module="In-Commerce" Type="1">RGFuaXNoIEtyb25l</PHRASE>
<PHRASE Label="la_DOP" Module="In-Commerce" Type="1">RG9taW5pY2FuIFBlc28=</PHRASE>
<PHRASE Label="la_DZD" Module="In-Commerce" Type="1">QWxnZXJpYW4gRGluYXI=</PHRASE>
<PHRASE Label="la_ECS" Module="In-Commerce" Type="1">U3VjcmU=</PHRASE>
<PHRASE Label="la_ECV" Module="In-Commerce" Type="1">VW5pZGFkIGRlIFZhbG9yIENvbnN0YW50ZSAoVVZDKQ==</PHRASE>
<PHRASE Label="la_Edit_User" Module="In-Commerce" Type="1">RWRpdCBVc2Vy</PHRASE>
<PHRASE Label="la_EEK" Module="In-Commerce" Type="1">S3Jvb24=</PHRASE>
<PHRASE Label="la_EGP" Module="In-Commerce" Type="1">RWd5cHRpYW4gUG91bmQ=</PHRASE>
<PHRASE Label="la_EnableBackorderAvailabilityDate" Module="In-Commerce" Type="1">RW5hYmxlIGJhY2tvcmRlciBhdmFpbGFiaWxpdHkgZGF0ZQ==</PHRASE>
<PHRASE Label="la_EnableBackordering" Module="In-Commerce" Type="1">RW5hYmxlIEJhY2tvcmRlcmluZw==</PHRASE>
<PHRASE Label="la_enable_html" Module="In-Commerce" Type="1">RW5hYmxlIEhUTUw/</PHRASE>
<PHRASE Label="la_EnterNumberOfCopies" Module="In-Commerce" Type="1">TnVtYmVyIE9mIENvcGllcw==</PHRASE>
<PHRASE Label="la_EntireOrderConfirmation" Module="In-Commerce" Type="1">VGhpcyB3aWxsIHJlbW92ZSBhbGwgc2VsZWN0ZWQgcHJvZHVjdHMhIEFyZSB5b3Ugc3VyZT8=</PHRASE>
<PHRASE Label="la_ERN" Module="In-Commerce" Type="1">TmFrZmE=</PHRASE>
<PHRASE Label="la_error_CannotDeletePaymentType" Module="In-Commerce" Type="1">VGhlIHByaW1hcnkgcGF5bWVudCB0eXBlIGNhbm5vdCBiZSBkZWxldGVkIQ==</PHRASE>
<PHRASE Label="la_error_EnableCurlFirst" Module="In-Commerce" Type="1">RW5hYmxlIENVUkwgZmlyc3Q=</PHRASE>
<PHRASE Label="la_error_FillInShippingFromAddress" Module="In-Commerce" Type="1">RmlsbCBpbiBTaGlwcGluZyBGcm9tIGFkZHJlc3MgaW4gQ29udGFjdCBJbmZvcm1hdGlvbiBiZWZvcmUgZW5hYmxpbmcgSW50ZXJzaGlwcGVy</PHRASE>
<PHRASE Label="la_ETB" Module="In-Commerce" Type="1">RXRoaW9waWFuIEJpcnI=</PHRASE>
<PHRASE Label="la_EUR" Module="In-Commerce" Type="1">RXVybw==</PHRASE>
<PHRASE Label="la_EuropeanCentralBank" Module="In-Commerce" Type="1">RXVyb3BlYW4gQ2VudHJhbCBCYW5rIC0gd3d3LmVjYi5pbnQ=</PHRASE>
<PHRASE Label="la_ExchangeRateSource" Module="In-Commerce" Type="1">Q2hvb3NlIHRoZSBleGNoYW5nZSByYXRlIHNvdXJjZQ==</PHRASE>
<PHRASE Label="la_Expiration" Module="In-Commerce" Type="1">RXhwaXJhdGlvbg==</PHRASE>
<PHRASE Label="la_Features" Module="In-Commerce" Type="1">RmVhdHVyZXM=</PHRASE>
<PHRASE Label="la_FederalReserveBank" Module="In-Commerce" Type="1">RmVkZXJhbCBSZXNlcnZlIEJhbmsgb2YgTmV3IFlvcmsgLSB3d3cubnkuZnJiLm9yZw==</PHRASE>
<PHRASE Label="la_FJD" Module="In-Commerce" Type="1">RmlqaSBEb2xsYXI=</PHRASE>
<PHRASE Label="la_FKP" Module="In-Commerce" Type="1">RmFsa2xhbmQgSXNsYW5kcyBQb3VuZA==</PHRASE>
<PHRASE Label="la_Flat" Module="In-Commerce" Type="1">RmxhdA==</PHRASE>
<PHRASE Label="la_fld_AccessDuration" Module="In-Commerce" Type="1" Column="QWNjZXNzIER1cmF0aW9u">QWNjZXNzIER1cmF0aW9u</PHRASE>
<PHRASE Label="la_fld_AccessDurationType" Module="In-Commerce" Type="1">QWNjZXNzIER1cmF0aW9uIFR5cGU=</PHRASE>
<PHRASE Label="la_fld_AccessDurationUnit" Module="In-Commerce" Type="1" Column="QWNjZXNzIER1cmF0aW9uIFVuaXQ=">QWNjZXNzIER1cmF0aW9uIFVuaXQ=</PHRASE>
<PHRASE Label="la_fld_AccessEnd" Module="In-Commerce" Type="1">QWNjZXNzIEVuZA==</PHRASE>
<PHRASE Label="la_fld_AccessGroup" Module="In-Commerce" Type="1">QWNjZXNzIEdyb3Vw</PHRASE>
<PHRASE Label="la_fld_AccessStart" Module="In-Commerce" Type="1">QWNjZXNzIFN0YXJ0</PHRASE>
<PHRASE Label="la_fld_AccumulatedAmount" Module="In-Commerce" Type="1">QWNjdW11bGF0ZWQgQW1vdW50</PHRASE>
<PHRASE Label="la_fld_AddedOn" Module="In-Commerce" Type="1" Column="QWRkZWQgT24=">QWRkZWQgT24=</PHRASE>
<PHRASE Label="la_fld_Address1" Module="In-Commerce" Type="1">QWRkcmVzcyBMaW5lIDE=</PHRASE>
<PHRASE Label="la_fld_Address2" Module="In-Commerce" Type="1">QWRkcmVzcyBMaW5lIDI=</PHRASE>
<PHRASE Label="la_fld_AdminComment" Module="In-Commerce" Type="1">QWRtaW4gQ29tbWVudA==</PHRASE>
<PHRASE Label="la_fld_AdminComments" Module="In-Commerce" Type="1">QWRtaW4gQ29tbWVudHM=</PHRASE>
<PHRASE Label="la_fld_AffiliateCode" Module="In-Commerce" Type="1">QWZmaWxpYXRlIENvZGU=</PHRASE>
<PHRASE Label="la_fld_AffiliateCommission" Module="In-Commerce" Type="1">QWZmaWxpYXRlIENvbW1pc3Npb24=</PHRASE>
<PHRASE Label="la_fld_AffiliateLink" Module="In-Commerce" Type="1">QWZmaWxpYXRlIExpbms=</PHRASE>
<PHRASE Label="la_fld_AffiliatePlan" Module="In-Commerce" Type="1">QWZmaWxpYXRlIFBsYW4=</PHRASE>
<PHRASE Label="la_fld_AffiliatePlanPayment" Module="In-Commerce" Type="1">UGF5bWVudA==</PHRASE>
<PHRASE Label="la_fld_AffiliateUser" Module="In-Commerce" Type="1" Column="QWZmaWxpYXRlIFVzZXI=">QWZmaWxpYXRlIFVzZXI=</PHRASE>
<PHRASE Label="la_fld_AllowedShippingTypes" Module="In-Commerce" Type="1">U2VsZWN0ZWQ=</PHRASE>
<PHRASE Label="la_fld_Amount" Module="In-Commerce" Type="1" Column="QW1vdW50">QW1vdW50</PHRASE>
<PHRASE Label="la_fld_AmountToPay" Module="In-Commerce" Type="1">QW1vdW50IFRvIFBheQ==</PHRASE>
<PHRASE Label="la_fld_AssignedCoupon" Module="In-Commerce" Type="1">QXNzaWduZWQgQ291cG9u</PHRASE>
<PHRASE Label="la_fld_AuthorizationResult" Module="In-Commerce" Type="1">QXV0aG9yaXphdGlvbiBSZXN1bHQ=</PHRASE>
<PHRASE Label="la_fld_Availability" Module="In-Commerce" Type="1" Column="QXZhaWwu">QXZhaWxhYmxl</PHRASE>
<PHRASE Label="la_fld_AvailableGroups" Module="In-Commerce" Type="1">QXZhaWxhYmxlIFVzZXIgR3JvdXBz</PHRASE>
<PHRASE Label="la_fld_AvailableShippingTypes" Module="In-Commerce" Type="1">QXZhaWxhYmxl</PHRASE>
<PHRASE Label="la_fld_BackOrder" Module="In-Commerce" Type="1">QmFja09yZGVy</PHRASE>
<PHRASE Label="la_fld_BackOrderDate" Module="In-Commerce" Type="1">QmFja29yZGVyIGF2YWlsYWJpbGl0eSBkYXRl</PHRASE>
<PHRASE Label="la_fld_BaseFee" Module="In-Commerce" Type="1" Column="QmFzZSBGZWU=">QmFzZSBGZWU=</PHRASE>
<PHRASE Label="la_fld_BillingAddress1" Module="In-Commerce" Type="1">QmlsbGluZyBBZGRyZXNzIExpbmUgMQ==</PHRASE>
<PHRASE Label="la_fld_BillingAddress2" Module="In-Commerce" Type="1">QmlsbGluZyBBZGRyZXNzIExpbmUgMg==</PHRASE>
<PHRASE Label="la_fld_BillingCity" Module="In-Commerce" Type="1">QmlsbGluZyBDaXR5</PHRASE>
<PHRASE Label="la_fld_BillingCompany" Module="In-Commerce" Type="1">QmlsbGluZyBDb21wYW55</PHRASE>
<PHRASE Label="la_fld_BillingCountry" Module="In-Commerce" Type="1" Column="QmlsbGluZyBDb3VudHJ5">QmlsbGluZyBDb3VudHJ5</PHRASE>
<PHRASE Label="la_fld_BillingEmail" Module="In-Commerce" Type="1">QmlsbGluZyBFbWFpbA==</PHRASE>
<PHRASE Label="la_fld_BillingFax" Module="In-Commerce" Type="1">QmlsbGluZyBGYXg=</PHRASE>
<PHRASE Label="la_fld_BillingPhone" Module="In-Commerce" Type="1">QmlsbGluZyBQaG9uZQ==</PHRASE>
<PHRASE Label="la_fld_BillingState" Module="In-Commerce" Type="1">QmlsbGluZyBTdGF0ZQ==</PHRASE>
<PHRASE Label="la_fld_BillingTo" Module="In-Commerce" Type="1">QmlsbGluZyBUbw==</PHRASE>
<PHRASE Label="la_fld_BillingZip" Module="In-Commerce" Type="1">QmlsbGluZyBaaXBjb2Rl</PHRASE>
<PHRASE Label="la_fld_BlockShippingAddress" Module="In-Commerce" Type="1">QmxvY2sgU2hpcHBpbmcgQWRkcmVzcyBFZGl0aW5n</PHRASE>
<PHRASE Label="la_fld_CaptureResult" Module="In-Commerce" Type="1">Q2FwdHVyZSBSZXN1bHQ=</PHRASE>
<PHRASE Label="la_fld_ChargeOnNextApprove" Module="In-Commerce" Type="1">Q2hhcmdlIG9uIE5leHQgQXBwcm92ZQ==</PHRASE>
<PHRASE Label="la_fld_CODallowed" Module="In-Commerce" Type="1" Column="Q09EIEFsbG93ZWQ=">Q09EIEFsbG93ZWQ=</PHRASE>
<PHRASE Label="la_fld_Code" Module="In-Commerce" Type="1" Column="Q29kZQ==">Q29kZQ==</PHRASE>
<PHRASE Label="la_fld_CODFlatSurcharge" Module="In-Commerce" Type="1" Column="Q09EIEZsYXQgU3VyZWNoYXJnZQ==">Q09EIEZsYXQgU3VyY2hhcmdl</PHRASE>
<PHRASE Label="la_fld_CODPercentSurcharge" Module="In-Commerce" Type="1" Column="Q09EIFBlcmNlbnQgU3VyY2hhcmdl">Q09EIFBlcmNlbnQgU3VyY2hhcmdl</PHRASE>
<PHRASE Label="la_fld_Comment" Module="In-Commerce" Type="1" Column="Q29tbWVudA==">Q29tbWVudA==</PHRASE>
<PHRASE Label="la_fld_Cost" Module="In-Commerce" Type="1" Column="Q29zdA==">Q29zdA==</PHRASE>
<PHRASE Label="la_fld_CostType" Module="In-Commerce" Type="1">Q29zdCBUeXBl</PHRASE>
<PHRASE Label="la_fld_CouponCode" Module="In-Commerce" Type="1" Column="Q291cG9uIENvZGU=">Q291cG9uIENvZGU=</PHRASE>
<PHRASE Label="la_fld_CreditCardNumber" Module="In-Commerce" Type="1" Column="Q3JlZGl0IENhcmQgTnVtYmVy">Q3JlZGl0IENhcmQgTnVtYmVy</PHRASE>
<PHRASE Label="la_fld_Currencies" Module="In-Commerce" Type="1">Q3VycmVuY2llcw==</PHRASE>
<PHRASE Label="la_fld_Currency" Module="In-Commerce" Type="1" Column="Q3VycmVuY3k=">Q3VycmVuY3k=</PHRASE>
<PHRASE Label="la_fld_CurrencyName" Module="In-Commerce" Type="1" Column="TmFtZQ==">TmFtZQ==</PHRASE>
<PHRASE Label="la_fld_CurrencySymbol" Module="In-Commerce" Type="1" Column="U3ltYm9s">U3ltYm9s</PHRASE>
<PHRASE Label="la_fld_CurrencySymbolPosition" Module="In-Commerce" Type="1" Column="U3ltYm9sIFBvc2l0aW9u">U3ltYm9sIFBvc2l0aW9u</PHRASE>
<PHRASE Label="la_fld_cust_p_ItemTemplate" Module="In-Commerce" Type="1">UHJvZHVjdCBJdGVtIFRlbXBsYXRl</PHRASE>
<PHRASE Label="la_fld_Date" Module="In-Commerce" Type="1">RGF0ZQ==</PHRASE>
<PHRASE Label="la_fld_DeliveryMethod" Module="In-Commerce" Type="1">RGVsaXZlcnkgTWV0aG9k</PHRASE>
<PHRASE Label="la_fld_DescriptionExcerpt" Module="In-Commerce" Type="1">RXhjZXJwdA==</PHRASE>
<PHRASE Label="la_fld_Discount" Module="In-Commerce" Type="1">RGlzY291bnQ=</PHRASE>
<PHRASE Label="la_fld_DisplayOnFront" Module="In-Commerce" Type="1" Column="RGlzcGxheSBvbiBGcm9udC1FbmQ=">RGlzcGxheSBvbiBGcm9udC1FbmQ=</PHRASE>
<PHRASE Label="la_fld_EmptyCellsAre" Module="In-Commerce" Type="1">RW1wdHkgQ2VsbHMgQXJl</PHRASE>
<PHRASE Label="la_fld_End" Module="In-Commerce" Type="1" Column="RW5k">RW5kIERhdGU=</PHRASE>
<PHRASE Label="la_fld_Expiration" Module="In-Commerce" Type="1" Column="RXhwaXJhdGlvbg==">RXhwaXJhdGlvbg==</PHRASE>
<PHRASE Label="la_fld_Featured" Module="In-Commerce" Type="1">RmVhdHVyZWQ=</PHRASE>
<PHRASE Label="la_fld_FirstDayDelivery" Module="In-Commerce" Type="1">Rmlyc3QgRGF5</PHRASE>
<PHRASE Label="la_fld_FlatSurcharge" Module="In-Commerce" Type="1" Column="RmxhdCBTdXJjaGFyZ2U=">RmxhdCBTdXJjaGFyZ2U=</PHRASE>
<PHRASE Label="la_fld_FreeShippingMinAmount" Module="In-Commerce" Type="1">TWluaW11bSBPcmRlciBUb3RhbCBmb3IgRnJlZSBTaGlwcGluZw==</PHRASE>
<PHRASE Label="la_fld_From" Module="In-Commerce" Type="1">RnJvbQ==</PHRASE>
<PHRASE Label="la_fld_FromAmount" Module="In-Commerce" Type="1" Column="RnJvbSBBbW91bnQ=">RnJvbSBBbW91bnQ=</PHRASE>
<PHRASE Label="la_fld_FromDateTime" Module="In-Commerce" Type="1">RnJvbSBkYXRlL3RpbWU=</PHRASE>
<PHRASE Label="la_fld_Gateway" Module="In-Commerce" Type="1">R2F0ZXdheQ==</PHRASE>
<PHRASE Label="la_fld_GiftCertificateAmountApplied" Module="In-Commerce" Type="1">R2lmdCBDZXJ0aWZpY2F0ZSBhbW91bnQ=</PHRASE>
<PHRASE Label="la_fld_GiftCertificateNumber" Module="In-Commerce" Type="1">R2lmdCBDZXJ0aWZpY2F0ZSBudW1iZXI=</PHRASE>
<PHRASE Label="la_fld_GroundDelivery" Module="In-Commerce" Type="1">R3JvdW5kIERlbGl2ZXJ5</PHRASE>
<PHRASE Label="la_fld_Groups" Module="In-Commerce" Type="1">VXNlciBHcm91cHMgU2VsZWN0aW9u</PHRASE>
<PHRASE Label="la_fld_Instructions" Module="In-Commerce" Type="1">SW5zdHJ1Y3Rpb25z</PHRASE>
<PHRASE Label="la_fld_InsuranceFee" Module="In-Commerce" Type="1">SW5zdXJhbmNlIENvc3Q=</PHRASE>
<PHRASE Label="la_fld_Insurance_Fee" Module="In-Commerce" Type="1">SW5zdXJhbmNlIENvc3Q=</PHRASE>
<PHRASE Label="la_fld_Insurance_Type" Module="In-Commerce" Type="1">SW5zdXJhbmNlIFR5cGU=</PHRASE>
<PHRASE Label="la_fld_InventoryStatus" Module="In-Commerce" Type="1">RW5hYmxlZA==</PHRASE>
<PHRASE Label="la_fld_IsFreePromoShipping" Module="In-Commerce" Type="1" Column="UHJvbW8=">VXNlIGFzIEZyZWUgUHJvbW8gU2hpcHBpbmc=</PHRASE>
<PHRASE Label="la_fld_IsProfileAddress" Module="In-Commerce" Type="1" Column="UHJvZmlsZSBBZGRyZXNz">UHJvZmlsZSBBZGRyZXNz</PHRASE>
<PHRASE Label="la_fld_IsRecurringBilling" Module="In-Commerce" Type="1">UmVjdXJyaW5nIEJpbGxpbmc=</PHRASE>
<PHRASE Label="la_fld_ItemsSold" Module="In-Commerce" Type="1">SXRlbXMgU29sZA==</PHRASE>
<PHRASE Label="la_fld_LastPaymentDate" Module="In-Commerce" Type="1">TGFzdCBQYXltZW50IERhdGU=</PHRASE>
<PHRASE Label="la_fld_LastUsedAsBilling" Module="In-Commerce" Type="1" Column="TGFzdCBVc2VkIGFzIFNoaXBwaW5n">TGFzdCBVc2VkIGFzIEJpbGxpbmc=</PHRASE>
<PHRASE Label="la_fld_LastUsedAsShipping" Module="In-Commerce" Type="1" Column="TGFzdCBVc2VkIGFzIFNoaXBwaW5n">TGFzdCBVc2VkIGFzIFNoaXBwaW5n</PHRASE>
<PHRASE Label="la_fld_LastUsedBy" Module="In-Commerce" Type="1" Column="TGFzdCBVc2VkIEJ5">TGFzdCBVc2VkIEJ5</PHRASE>
<PHRASE Label="la_fld_LastUsedOn" Module="In-Commerce" Type="1" Column="TGFzdCBVc2VkIE9u">TGFzdCBVc2VkIE9u</PHRASE>
<PHRASE Label="la_fld_Listable" Module="In-Commerce" Type="1" Column="TGlzdGFibGU=">TGlzdGFibGU=</PHRASE>
<PHRASE Label="la_fld_ManageCombinations" Module="In-Commerce" Type="1">TWFuYWdlIE9wdGlvbnMgQ29tYmluYXRpb25z</PHRASE>
<PHRASE Label="la_fld_ManageShipping" Module="In-Commerce" Type="1">TWFuYWdlIFNoaXBwaW5nIFR5cGVz</PHRASE>
<PHRASE Label="la_fld_Manufacturer" Module="In-Commerce" Type="1" Column="TWFudWZhY3R1cmVy">TWFudWZhY3R1cmVy</PHRASE>
<PHRASE Label="la_fld_MaxQty" Module="In-Commerce" Type="1" Column="TWF4IFF0eQ==">TWF4IFF0eQ==</PHRASE>
<PHRASE Label="la_fld_MinimumPaymentAmount" Module="In-Commerce" Type="1">TWluaW1hbCBQYXltZW50IEFtb3VudA==</PHRASE>
<PHRASE Label="la_fld_MinQty" Module="In-Commerce" Type="1" Column="TWluIFF0eQ==">TWluIFF0eQ==</PHRASE>
<PHRASE Label="la_fld_MSRP" Module="In-Commerce" Type="1">TVNSUA==</PHRASE>
<PHRASE Label="la_fld_Negotiated" Module="In-Commerce" Type="1" Column="TmVnb3RpYXRlZA==">TmVnb3RpYXRlZA==</PHRASE>
<PHRASE Label="la_fld_NextCharge" Module="In-Commerce" Type="1">TmV4dCBDaGFyZ2UgRGF0ZQ==</PHRASE>
<PHRASE Label="la_fld_NumberOfUses" Module="In-Commerce" Type="1" Column="TnVtYmVyIE9mIFVzZXM=">TnVtYmVyIE9mIFVzZXM=</PHRASE>
<PHRASE Label="la_fld_OnHold" Module="In-Commerce" Type="1" Column="T24gSG9sZA==">T24gSG9sZA==</PHRASE>
<PHRASE Label="la_fld_OnSale" Module="In-Commerce" Type="1" Column="T24gU2FsZQ==">UHJvZHVjdCBvbiBTYWxl</PHRASE>
<PHRASE Label="la_fld_OptionPrice" Module="In-Commerce" Type="1">T3B0aW9uIFByaWNl</PHRASE>
<PHRASE Label="la_fld_OptionsSelectionMode" Module="In-Commerce" Type="1">T3B0aW9ucyBTZWxlY3Rpb24gTW9kZQ==</PHRASE>
<PHRASE Label="la_fld_OptionType" Module="In-Commerce" Type="1" Column="T3B0aW9uIFR5cGU=">T3B0aW9uIFR5cGU=</PHRASE>
<PHRASE Label="la_fld_OptionValue" Module="In-Commerce" Type="1">T3B0aW9uIFZhbHVl</PHRASE>
<PHRASE Label="la_fld_OptionValues" Module="In-Commerce" Type="1">T3B0aW9uIFZhbHVlcw==</PHRASE>
<PHRASE Label="la_fld_OrderId" Module="In-Commerce" Type="1">T3JkZXIgSUQ=</PHRASE>
<PHRASE Label="la_fld_OrderIP" Module="In-Commerce" Type="1" Column="SVAgQWRkcmVzcw==">SVAgQWRkcmVzcw==</PHRASE>
<PHRASE Label="la_fld_OrderNumber" Module="In-Commerce" Type="1" Column="TnVtYmVy">TnVtYmVy</PHRASE>
<PHRASE Label="la_fld_Original" Module="In-Commerce" Type="1">T3JpZ2luYWw=</PHRASE>
<PHRASE Label="la_fld_OriginalAmount" Module="In-Commerce" Type="1">T3JpZ2luYWwgQW1vdW50</PHRASE>
<PHRASE Label="la_fld_PaymentAccount" Module="In-Commerce" Type="1">UGF5bWVudCBBY2NvdW50</PHRASE>
<PHRASE Label="la_fld_PaymentCardType" Module="In-Commerce" Type="1">Q2FyZCBUeXBl</PHRASE>
<PHRASE Label="la_fld_PaymentCCExpDate" Module="In-Commerce" Type="1">Q2FyZCBFeHBpcmF0aW9u</PHRASE>
<PHRASE Label="la_fld_PaymentCVV2" Module="In-Commerce" Type="1">Q1ZWMg==</PHRASE>
<PHRASE Label="la_fld_PaymentDate" Module="In-Commerce" Type="1" Column="UGF5bWVudCBEYXRl">UGF5bWVudCBEYXRl</PHRASE>
<PHRASE Label="la_fld_PaymentExpires" Module="In-Commerce" Type="1">UGF5bWVudCBEYXRlL0V4cGlyYXRpb24=</PHRASE>
<PHRASE Label="la_fld_PaymentInterval" Module="In-Commerce" Type="1">UGF5bWVudCBJbnRlcnZhbA==</PHRASE>
<PHRASE Label="la_fld_PaymentNameOnCard" Module="In-Commerce" Type="1">TmFtZSBvbiB0aGUgQ2FyZA==</PHRASE>
<PHRASE Label="la_fld_PaymentReference" Module="In-Commerce" Type="1" Column="UGF5bWVudCBSZWZlcmVuY2U=">UGF5bWVudCBSZWZlcmVuY2U=</PHRASE>
<PHRASE Label="la_fld_PaymentType" Module="In-Commerce" Type="1" Column="UGF5bWVudCBUeXBl">UGF5bWVudCBUeXBl</PHRASE>
<PHRASE Label="la_fld_PaymentTypeCurrencies" Module="In-Commerce" Type="1">QXZhaWxhYmxlIEN1cnJlbmNpZXM=</PHRASE>
<PHRASE Label="la_fld_PaymentTypeId" Module="In-Commerce" Type="1">UGF5bWVudCBUeXBlIElk</PHRASE>
<PHRASE Label="la_fld_PaymentTypes" Module="In-Commerce" Type="1">UGF5bWVudCBUeXBlcw==</PHRASE>
<PHRASE Label="la_fld_PercentSurcharge" Module="In-Commerce" Type="1" Column="UGVyY2VudCBTdXJjaGFyZ2U=">UGVyY2VudCBTdXJjaGFyZ2U=</PHRASE>
<PHRASE Label="la_fld_Period" Module="In-Commerce" Type="1">UGVyaW9k</PHRASE>
<PHRASE Label="la_fld_PlacedOrdersEdit" Module="In-Commerce" Type="1">QWxsb3cgUGxhY2VkIE9yZGVycyBFZGl0aW5n</PHRASE>
<PHRASE Label="la_fld_PlanType" Module="In-Commerce" Type="1" Column="UGxhbiBUeXBl">UGxhbiBUeXBl</PHRASE>
<PHRASE Label="la_fld_Points" Module="In-Commerce" Type="1" Column="UG9pbnRz">UG9pbnRz</PHRASE>
<PHRASE Label="la_fld_Price" Module="In-Commerce" Type="1" Column="UHJpY2U=">UHJpY2U=</PHRASE>
<PHRASE Label="la_fld_PriceType" Module="In-Commerce" Type="1">UHJpY2UgTW9kaWZpZXIgVHlwZQ==</PHRASE>
<PHRASE Label="la_fld_ProcessingFee" Module="In-Commerce" Type="1">UHJvY2Vzc2luZyBGZWU=</PHRASE>
<PHRASE Label="la_fld_ProductFreeShipping" Module="In-Commerce" Type="1">TWluaW11bSBxdWFudGl0eSBmb3IgRnJlZSBTaGlwcGluZw==</PHRASE>
<PHRASE Label="la_fld_ProductType" Module="In-Commerce" Type="1" Column="VHlwZQ==">UHJvZHVjdCBUeXBl</PHRASE>
<PHRASE Label="la_fld_Product_MaxHotNumber" Module="In-Commerce" Type="1">TWF4aW11bSBudW1iZXIgb2YgVG9wIFNlbGxlciBpdGVtcw==</PHRASE>
<PHRASE Label="la_fld_Product_MinPopRating" Module="In-Commerce" Type="1">TWluaW11bSByYXRpbmcgdG8gY29uc2lkZXIgaXRlbSBQT1A=</PHRASE>
<PHRASE Label="la_fld_Product_MinPopVotes" Module="In-Commerce" Type="1">TWluaW11bSBudW1iZXIgb2Ygc29sZCBpdGVtcyB0byBjb25zaWRlciBpdGVtIFBPUA==</PHRASE>
<PHRASE Label="la_fld_QtyBackOrdered" Module="In-Commerce" Type="1" Column="QmFja29yZGVyZWQ=">UXR5IEJhY2tPcmRlcmVk</PHRASE>
<PHRASE Label="la_fld_QtyInStock" Module="In-Commerce" Type="1" Column="UXR5IEluIFN0b2Nr">UXR5IEluIFN0b2Nr</PHRASE>
<PHRASE Label="la_fld_QtyInStockMin" Module="In-Commerce" Type="1" Column="UXR5SW5TdG9ja01pbg==">TWluaW11bSBxdWFudGl0eSBpbiBzdG9jayB0aHJlc2hvbGQ=</PHRASE>
<PHRASE Label="la_fld_QtyOnOrder" Module="In-Commerce" Type="1" Column="UXR5IE9uIE9yZGVy">UXR5IE9uIE9yZGVy</PHRASE>
<PHRASE Label="la_fld_QtyReserved" Module="In-Commerce" Type="1" Column="UXR5IFJlc2VydmVk">UXR5IFJlc2VydmVk</PHRASE>
<PHRASE Label="la_fld_QtySold" Module="In-Commerce" Type="1">UXR5IFNvbGQ=</PHRASE>
<PHRASE Label="la_fld_RateToPrimary" Module="In-Commerce" Type="1" Column="UmF0ZSBUbyBQcmltYXJ5">UmF0ZSBUbyBQcmltYXJ5</PHRASE>
<PHRASE Label="la_fld_RegisteredOn" Module="In-Commerce" Type="1" Column="UmVnaXN0ZXJlZCBPbg==">UmVnaXN0ZXJlZCBPbg==</PHRASE>
<PHRASE Label="la_fld_RemainingAmount" Module="In-Commerce" Type="1" Column="UmVtYWluaW5nIEFtb3VudA==">UmVtYWluaW5nIEFtb3VudA==</PHRASE>
<PHRASE Label="la_fld_ReportType" Module="In-Commerce" Type="1">UmVwb3J0IFR5cGU=</PHRASE>
<PHRASE Label="la_fld_SecondDayDelivery" Module="In-Commerce" Type="1">U2Vjb25kIERheQ==</PHRASE>
<PHRASE Label="la_fld_SelectedGroups" Module="In-Commerce" Type="1">U2VsZWN0ZWQgVXNlciBHcm91cHM=</PHRASE>
<PHRASE Label="la_fld_ShipMethod" Module="In-Commerce" Type="1">U2hpcCBNZXRob2Q=</PHRASE>
<PHRASE Label="la_fld_ShippingAddress1" Module="In-Commerce" Type="1">U2hpcHBpbmcgQWRkcmVzcyBMaW5lIDE=</PHRASE>
<PHRASE Label="la_fld_ShippingAddress2" Module="In-Commerce" Type="1">U2hpcHBpbmcgQWRkcmVzcyBMaW5lIDI=</PHRASE>
<PHRASE Label="la_fld_ShippingCity" Module="In-Commerce" Type="1">U2hpcHBpbmcgQ2l0eQ==</PHRASE>
<PHRASE Label="la_fld_ShippingCode" Module="In-Commerce" Type="1">Q29kZQ==</PHRASE>
<PHRASE Label="la_fld_ShippingCompany" Module="In-Commerce" Type="1">U2hpcHBpbmcgQ29tcGFueQ==</PHRASE>
<PHRASE Label="la_fld_ShippingControl" Module="In-Commerce" Type="1">U2hpcHBpbmcgQ29udHJvbA==</PHRASE>
<PHRASE Label="la_fld_ShippingCost" Module="In-Commerce" Type="1">U2hpcHBpbmcgQ29zdA==</PHRASE>
<PHRASE Label="la_fld_ShippingCountry" Module="In-Commerce" Type="1" Column="U2hpcHBpbmcgQ291bnRyeQ==">U2hpcHBpbmcgQ291bnRyeQ==</PHRASE>
<PHRASE Label="la_fld_ShippingCustomerAccount" Module="In-Commerce" Type="1">U2hpcHBpbmcgQ3VzdG9tZXIgQWNjb3VudA==</PHRASE>
<PHRASE Label="la_fld_ShippingDate" Module="In-Commerce" Type="1">U2hpcHBpbmcgRGF0ZS9UaW1l</PHRASE>
<PHRASE Label="la_fld_ShippingEmail" Module="In-Commerce" Type="1">U2hpcHBpbmcgRW1haWw=</PHRASE>
<PHRASE Label="la_fld_ShippingFax" Module="In-Commerce" Type="1">U2hpcHBpbmcgRmF4</PHRASE>
<PHRASE Label="la_fld_ShippingMode" Module="In-Commerce" Type="1">QWxsb3dlZCBTaGlwcGluZyBUeXBlcw==</PHRASE>
<PHRASE Label="la_fld_ShippingName" Module="In-Commerce" Type="1" Column="TmFtZQ==">TmFtZQ==</PHRASE>
<PHRASE Label="la_fld_ShippingOption" Module="In-Commerce" Type="1">U2hpcHBpbmcgT3B0aW9u</PHRASE>
<PHRASE Label="la_fld_ShippingOptions" Module="In-Commerce" Type="1">U2hpcHBpbmcgT3B0aW9ucw==</PHRASE>
<PHRASE Label="la_fld_ShippingPhone" Module="In-Commerce" Type="1">U2hpcHBpbmcgUGhvbmU=</PHRASE>
<PHRASE Label="la_fld_ShippingQuoteEngineName" Module="In-Commerce" Type="1" Column="TmFtZQ==">TmFtZQ==</PHRASE>
<PHRASE Label="la_fld_ShippingState" Module="In-Commerce" Type="1">U2hpcHBpbmcgU3RhdGU=</PHRASE>
<PHRASE Label="la_fld_ShippingTo" Module="In-Commerce" Type="1">U2hpcHBpbmcgVG8=</PHRASE>
<PHRASE Label="la_fld_ShippingTracking" Module="In-Commerce" Type="1">U2hpcHBpbmcgVHJhY2tpbmcvUmVmZXJlbmNl</PHRASE>
<PHRASE Label="la_fld_ShippingType" Module="In-Commerce" Type="1" Column="VHlwZQ==">U2hpcHBpbmcgVHlwZQ==</PHRASE>
<PHRASE Label="la_fld_ShippingTypeId" Module="In-Commerce" Type="1">U2hpcHBpbmcgVHlwZSBJRA==</PHRASE>
<PHRASE Label="la_fld_ShippingTypes" Module="In-Commerce" Type="1">U2hpcHBpbmcgVHlwZXM=</PHRASE>
<PHRASE Label="la_fld_ShippingZip" Module="In-Commerce" Type="1">U2hpcHBpbmcgWmlwY29kZQ==</PHRASE>
<PHRASE Label="la_fld_ShipZoneName" Module="In-Commerce" Type="1" Column="U2hpcHBpbmcgWm9uZSBOYW1l">U2hpcHBpbmcgWm9uZSBOYW1l</PHRASE>
<PHRASE Label="la_fld_SKU" Module="In-Commerce" Type="1" Column="U0tV">U0tV</PHRASE>
<PHRASE Label="la_fld_SpeedCode" Module="In-Commerce" Type="1" Column="U2hpcHBpbmcgU3BlZWQ=">U3BlZWQgQ29kZQ==</PHRASE>
<PHRASE Label="la_fld_SSN" Module="In-Commerce" Type="1">U1NOL1RheCBJZC9WQVQgTnVtYmVy</PHRASE>
<PHRASE Label="la_fld_Start" Module="In-Commerce" Type="1" Column="U3RhcnQ=">U3RhcnQgRGF0ZQ==</PHRASE>
<PHRASE Label="la_fld_SubTotal" Module="In-Commerce" Type="1">U3VidG90YWw=</PHRASE>
<PHRASE Label="la_fld_TaxApplyToProcessing" Module="In-Commerce" Type="1" Column="QXBwbHkgdG8gUHJvY2Vzc2luZw==">QXBwbHkgdG8gUHJvY2Vzc2luZw==</PHRASE>
<PHRASE Label="la_fld_TaxApplyToShipping" Module="In-Commerce" Type="1" Column="QXBwbHkgdG8gU2hpcHBpbmc=">QXBwbHkgdG8gU2hpcHBpbmc=</PHRASE>
<PHRASE Label="la_fld_TaxValue" Module="In-Commerce" Type="1" Column="VGF4IFZhbHVl">VGF4IFZhbHVl</PHRASE>
<PHRASE Label="la_fld_TaxZoneName" Module="In-Commerce" Type="1" Column="VGF4IFpvbmUgTmFtZQ==">TmFtZSBvZiBUYXggWm9uZQ==</PHRASE>
<PHRASE Label="la_fld_ThirdDayDelivery" Module="In-Commerce" Type="1">VGhpcmQgRGF5</PHRASE>
<PHRASE Label="la_fld_Time" Module="In-Commerce" Type="1">VGltZQ==</PHRASE>
<PHRASE Label="la_fld_ToAmount" Module="In-Commerce" Type="1" Column="VG8gQW1vdW50">VG8gQW1vdW50</PHRASE>
<PHRASE Label="la_fld_ToDateTime" Module="In-Commerce" Type="1">VG8gZGF0ZS90aW1l</PHRASE>
<PHRASE Label="la_fld_TopSeller" Module="In-Commerce" Type="1">VG9wIFNlbGxlcg==</PHRASE>
<PHRASE Label="la_fld_TotalAmount" Module="In-Commerce" Type="1" Column="VG90YWwgQW1vdW50">VG90YWwgQW1vdW50</PHRASE>
<PHRASE Label="la_fld_TotalReturns" Module="In-Commerce" Type="1">VG90YWwgUmV0dXJucw==</PHRASE>
<PHRASE Label="la_fld_TotalSavings" Module="In-Commerce" Type="1">VG90YWwgU2F2aW5ncw==</PHRASE>
<PHRASE Label="la_fld_UnitsLimit" Module="In-Commerce" Type="1" Column="TGltaXQ=">TGluaXQ=</PHRASE>
<PHRASE Label="la_fld_UserComment" Module="In-Commerce" Type="1">VXNlciBDb21tZW50</PHRASE>
<PHRASE Label="la_fld_VAT" Module="In-Commerce" Type="1">U2FsZXMgVGF4L1ZBVA==</PHRASE>
<PHRASE Label="la_fld_VATIncluded" Module="In-Commerce" Type="1">VkFUIEluY2x1ZGVk</PHRASE>
<PHRASE Label="la_fld_VerificationResult" Module="In-Commerce" Type="1">VmVyaWZpY2F0aW9uIFJlc3VsdA==</PHRASE>
<PHRASE Label="la_fld_Weight" Module="In-Commerce" Type="1" Column="V2VpZ2h0">V2VpZ2h0</PHRASE>
<PHRASE Label="la_fld_WeightType" Module="In-Commerce" Type="1">V2VpZ2h0IE1vZGlmaWVyIFR5cGU=</PHRASE>
<PHRASE Label="la_fld_ZoneName" Module="In-Commerce" Type="1" Column="Wm9uZSBOYW1l">Wm9uZSBOYW1l</PHRASE>
<PHRASE Label="la_fld_ZoneType" Module="In-Commerce" Type="1" Column="Wm9uZSBUeXBl">VHlwZQ==</PHRASE>
<PHRASE Label="la_fld_Zone_Type" Module="In-Commerce" Type="1">VHlwZQ==</PHRASE>
<PHRASE Label="la_FontColor" Module="In-Commerce" Type="1">Rm9udCBDb2xvcg==</PHRASE>
<PHRASE Label="la_FreeShipping" Module="In-Commerce" Type="1">RnJlZSBTaGlwcGluZw==</PHRASE>
<PHRASE Label="la_GBP" Module="In-Commerce" Type="1">UG91bmQgU3Rlcmxpbmc=</PHRASE>
<PHRASE Label="la_GEL" Module="In-Commerce" Type="1">TGFyaQ==</PHRASE>
<PHRASE Label="la_GenerateCode" Module="In-Commerce" Type="1">R2VuZXJhdGUgQ29kZQ==</PHRASE>
<PHRASE Label="la_GHC" Module="In-Commerce" Type="1">Q2VkaQ==</PHRASE>
<PHRASE Label="la_GIP" Module="In-Commerce" Type="1">R2licmFsdGFyIFBvdW5k</PHRASE>
<PHRASE Label="la_GMD" Module="In-Commerce" Type="1">RGFsYXNp</PHRASE>
<PHRASE Label="la_GNF" Module="In-Commerce" Type="1">R3VpbmVhIEZyYW5j</PHRASE>
<PHRASE Label="la_GTQ" Module="In-Commerce" Type="1">UXVldHphbA==</PHRASE>
<PHRASE Label="la_GWP" Module="In-Commerce" Type="1">R3VpbmVhLUJpc3NhdSBQZXNv</PHRASE>
<PHRASE Label="la_GYD" Module="In-Commerce" Type="1">R3V5YW5hIERvbGxhcg==</PHRASE>
<PHRASE Label="la_Handling" Module="In-Commerce" Type="1">aGFuZGxpbmc=</PHRASE>
<PHRASE Label="la_Help" Module="In-Commerce" Type="1">SGVscA==</PHRASE>
<PHRASE Label="la_HKD" Module="In-Commerce" Type="1">SG9uZyBLb25nIERvbGxhcg==</PHRASE>
<PHRASE Label="la_HNL" Module="In-Commerce" Type="1">TGVtcGlyYQ==</PHRASE>
<PHRASE Label="la_HRK" Module="In-Commerce" Type="1">Q3JvYXRpYW4ga3VuYQ==</PHRASE>
<PHRASE Label="la_HTG" Module="In-Commerce" Type="1">R291cmRl</PHRASE>
<PHRASE Label="la_HUF" Module="In-Commerce" Type="1">Rm9yaW50</PHRASE>
<PHRASE Label="la_IDR" Module="In-Commerce" Type="1">UnVwaWFo</PHRASE>
<PHRASE Label="la_ILS" Module="In-Commerce" Type="1">TmV3IElzcmFlbGkgU2hlcWVs</PHRASE>
<PHRASE Label="la_In-commerce" Module="In-Commerce" Type="1">SW4tQ29tbWVyY2U=</PHRASE>
<PHRASE Label="la_Incomplete" Module="In-Commerce" Type="1">SW5jb21wbGV0ZQ==</PHRASE>
<PHRASE Label="la_INR" Module="In-Commerce" Type="1">SW5kaWFuIFJ1cGVl</PHRASE>
<PHRASE Label="la_Insurance_Fee" Module="In-Commerce" Type="1">SW5zdXJhbmNl</PHRASE>
<PHRASE Label="la_InvalidState" Module="In-Commerce" Type="1">U3RhdGUgaXMgaW52YWxpZA==</PHRASE>
<PHRASE Label="la_Invoiced" Module="In-Commerce" Type="1">SW52b2ljZWQ=</PHRASE>
<PHRASE Label="la_IQD" Module="In-Commerce" Type="1">SXJhcWkgRGluYXI=</PHRASE>
<PHRASE Label="la_IRR" Module="In-Commerce" Type="1">SXJhbmlhbiBSaWFs</PHRASE>
<PHRASE Label="la_ISK" Module="In-Commerce" Type="1">SWNlbGFuZCBLcm9uYQ==</PHRASE>
<PHRASE Label="la_ISOUsedIfBlank" Module="In-Commerce" Type="1">SVNPIENvZGUgd2lsbCBiZSB1c2VkIGlmIGxlZnQgYmxhbms=</PHRASE>
<PHRASE Label="la_ItemBackordered" Module="In-Commerce" Type="1">YmFja29yZGVyZWQ=</PHRASE>
<PHRASE Label="la_ItemTab_Products" Module="In-Commerce" Type="1">UHJvZHVjdHM=</PHRASE>
<PHRASE Label="la_JMD" Module="In-Commerce" Type="1">SmFtYWljYW4gRG9sbGFy</PHRASE>
<PHRASE Label="la_JOD" Module="In-Commerce" Type="1">Sm9yZGFuaWFuIERpbmFy</PHRASE>
<PHRASE Label="la_JPY" Module="In-Commerce" Type="1">WWVu</PHRASE>
<PHRASE Label="la_KES" Module="In-Commerce" Type="1">S2VueWFuIFNoaWxsaW5n</PHRASE>
<PHRASE Label="la_kg" Module="In-Commerce" Type="1">a2c=</PHRASE>
<PHRASE Label="la_KGS" Module="In-Commerce" Type="1">U29t</PHRASE>
<PHRASE Label="la_KHR" Module="In-Commerce" Type="1">UmllbA==</PHRASE>
<PHRASE Label="la_KMF" Module="In-Commerce" Type="1">Q29tb3JvIEZyYW5j</PHRASE>
<PHRASE Label="la_KPW" Module="In-Commerce" Type="1">Tm9ydGggS29yZWFuIFdvbg==</PHRASE>
<PHRASE Label="la_KRW" Module="In-Commerce" Type="1">V29u</PHRASE>
<PHRASE Label="la_KWD" Module="In-Commerce" Type="1">S3V3YWl0aSBEaW5hcg==</PHRASE>
<PHRASE Label="la_KYD" Module="In-Commerce" Type="1">Q2F5bWFuIElzbGFuZHMgRG9sbGFy</PHRASE>
<PHRASE Label="la_KZT" Module="In-Commerce" Type="1">VGVuZ2U=</PHRASE>
<PHRASE Label="la_LAK" Module="In-Commerce" Type="1">S2lw</PHRASE>
<PHRASE Label="la_LBP" Module="In-Commerce" Type="1">TGViYW5lc2UgUG91bmQ=</PHRASE>
<PHRASE Label="la_lbs" Module="In-Commerce" Type="1">cG91bmRz</PHRASE>
<PHRASE Label="la_Left" Module="In-Commerce" Type="1">TGVmdA==</PHRASE>
<PHRASE Label="la_LKR" Module="In-Commerce" Type="1">U3JpIExhbmthIFJ1cGVl</PHRASE>
<PHRASE Label="la_LRD" Module="In-Commerce" Type="1">TGliZXJpYW4gRG9sbGFy</PHRASE>
<PHRASE Label="la_LSL" Module="In-Commerce" Type="1">TG90aQ==</PHRASE>
<PHRASE Label="la_LTL" Module="In-Commerce" Type="1">TGl0aHVhbmlhbiBMaXR1cw==</PHRASE>
<PHRASE Label="la_LVL" Module="In-Commerce" Type="1">TGF0dmlhbiBMYXRz</PHRASE>
<PHRASE Label="la_LYD" Module="In-Commerce" Type="1">THliaWFuIERpbmFy</PHRASE>
<PHRASE Label="la_MAD" Module="In-Commerce" Type="1">TW9yb2NjYW4gRGlyaGFt</PHRASE>
<PHRASE Label="la_Manual" Module="In-Commerce" Type="1">TWFudWFs</PHRASE>
<PHRASE Label="la_MaskProcessedCreditCards" Module="In-Commerce" Type="1">TWFzayBQcm9jZXNzZWQgQ3JlZGl0IENhcmRz</PHRASE>
<PHRASE Label="la_MaxAddresses" Module="In-Commerce" Type="1">TnVtYmVyIG9mIGFsbG93ZWQgYWRkcmVzc2Vz</PHRASE>
<PHRASE Label="la_MDL" Module="In-Commerce" Type="1">TW9sZG92YW4gTGV1</PHRASE>
<PHRASE Label="la_MGA" Module="In-Commerce" Type="1">TUdB</PHRASE>
<PHRASE Label="la_MGF" Module="In-Commerce" Type="1">TWFsYWdhc3kgRnJhbmM=</PHRASE>
<PHRASE Label="la_MKD" Module="In-Commerce" Type="1">RGVuYXI=</PHRASE>
<PHRASE Label="la_MMK" Module="In-Commerce" Type="1">S3lhdA==</PHRASE>
<PHRASE Label="la_MNT" Module="In-Commerce" Type="1">VHVncmlr</PHRASE>
<PHRASE Label="la_ModifyByValue" Module="In-Commerce" Type="1">VmFsdWU=</PHRASE>
<PHRASE Label="la_ModifyOperation" Module="In-Commerce" Type="1">T3BlcmF0aW9u</PHRASE>
<PHRASE Label="la_month" Module="In-Commerce" Type="1">bW9udGg=</PHRASE>
<PHRASE Label="la_MOP" Module="In-Commerce" Type="1">UGF0YWNh</PHRASE>
<PHRASE Label="la_MRO" Module="In-Commerce" Type="1">T3VndWl5YQ==</PHRASE>
<PHRASE Label="la_msg_ConfirmDeletePricing" Module="In-Commerce" Type="1">UGxlYXNlIGNvbmZpcm0geW91IHdhbnQgdG8gZGVsZXRlIHRoZSBQcmljaW5nIGZvciB0aGlzIFVzZXIgR3JvdXAuIENsaWNrIE9LIHRvIHByb2NlZWQgd2l0aCBkZWxldGlvbiwgb3IgY2xpY2sgQ2FuY2VsIHRvIGNhbmNlbCBpdC4=</PHRASE>
<PHRASE Label="la_MTL" Module="In-Commerce" Type="1">TWFsdGVzZSBMaXJh</PHRASE>
<PHRASE Label="la_MUR" Module="In-Commerce" Type="1">TWF1cml0aXVzIFJ1cGVl</PHRASE>
<PHRASE Label="la_MVR" Module="In-Commerce" Type="1">UnVmaXlhYQ==</PHRASE>
<PHRASE Label="la_MWK" Module="In-Commerce" Type="1">S3dhY2hh</PHRASE>
<PHRASE Label="la_MXN" Module="In-Commerce" Type="1">TWV4aWNhbiBQZXNv</PHRASE>
<PHRASE Label="la_MXV" Module="In-Commerce" Type="1">TWV4aWNhbiBVbmlkYWQgZGUgSW52ZXJzaW9uIChVREkp</PHRASE>
<PHRASE Label="la_MYR" Module="In-Commerce" Type="1">TWFsYXlzaWFuIFJpbmdnaXQ=</PHRASE>
<PHRASE Label="la_MZM" Module="In-Commerce" Type="1">TWV0aWNhbA==</PHRASE>
<PHRASE Label="la_NAD" Module="In-Commerce" Type="1">TmFtaWJpYSBEb2xsYXI=</PHRASE>
<PHRASE Label="la_NGN" Module="In-Commerce" Type="1">TmFpcmE=</PHRASE>
<PHRASE Label="la_NIO" Module="In-Commerce" Type="1">Q29yZG9iYSBPcm8=</PHRASE>
<PHRASE Label="la_NOK" Module="In-Commerce" Type="1">Tm9yd2VnaWFuIEtyb25l</PHRASE>
<PHRASE Label="la_NoShipments" Module="In-Commerce" Type="1">Tm8gU2hpcG1lbnRz</PHRASE>
<PHRASE Label="la_NotAllowed" Module="In-Commerce" Type="1">Tm90IEFsbG93ZWQ=</PHRASE>
<PHRASE Label="la_NoZonesOrBrackets" Module="In-Commerce" Type="1">WW91IG11c3QgaGF2ZSBib3RoIHpvbmVzIGFuZCBicmFja2V0cyBkZWZpbmVkIGJlZm9yZSBlZGl0aW5nIHNoaXBwaW5nIGNvc3Rz</PHRASE>
<PHRASE Label="la_NPR" Module="In-Commerce" Type="1">TmVwYWxlc2UgUnVwZWU=</PHRASE>
<PHRASE Label="la_NZD" Module="In-Commerce" Type="1">TmV3IFplYWxhbmQgRG9sbGFy</PHRASE>
<PHRASE Label="la_OMR" Module="In-Commerce" Type="1">UmlhbCBPbWFuaQ==</PHRASE>
<PHRASE Label="la_OnlineStore" Module="In-Commerce" Type="1">T25saW5lIFN0b3Jl</PHRASE>
<PHRASE Label="la_opt_AutoGroupShipments" Module="In-Commerce" Type="1">QXV0by1ncm91cCBzaGlwbWVudHM=</PHRASE>
<PHRASE Label="la_opt_Date" Module="In-Commerce" Type="1">RGF0ZQ==</PHRASE>
<PHRASE Label="la_opt_Exchange" Module="In-Commerce" Type="1">RXhjaGFuZ2U=</PHRASE>
<PHRASE Label="la_opt_Interval" Module="In-Commerce" Type="1">SW50ZXJ2YWw=</PHRASE>
<PHRASE Label="la_opt_List" Module="In-Commerce" Type="1">TGlzdGluZw==</PHRASE>
<PHRASE Label="la_opt_ManualGroupShipments" Module="In-Commerce" Type="1">R3JvdXAgc2hpcG1lbnRzIG1hbnVhbGx5</PHRASE>
<PHRASE Label="la_opt_PermanentCookie" Module="In-Commerce" Type="1">UGVybWFuZW50IENvb2tpZQ==</PHRASE>
<PHRASE Label="la_opt_PostalMail" Module="In-Commerce" Type="1">UG9zdGFsIE1haWw=</PHRASE>
<PHRASE Label="la_opt_PriceCalculationByOptimal" Module="In-Commerce" Type="1">T3B0aW1hbCBQcmljZQ==</PHRASE>
<PHRASE Label="la_opt_PriceCalculationByPrimary" Module="In-Commerce" Type="1">UHJpbWFyeSBQcmljZQ==</PHRASE>
<PHRASE Label="la_opt_Refund" Module="In-Commerce" Type="1">UmVmdW5k</PHRASE>
<PHRASE Label="la_opt_Selection" Module="In-Commerce" Type="1">U2VsZWN0aW9u</PHRASE>
<PHRASE Label="la_opt_Session" Module="In-Commerce" Type="1">U2Vzc2lvbg==</PHRASE>
<PHRASE Label="la_opt_Verified" Module="In-Commerce" Type="1">VmVyaWZpZWQ=</PHRASE>
<PHRASE Label="la_opt_Warranty" Module="In-Commerce" Type="1">V2FycmFudHk=</PHRASE>
<PHRASE Label="la_OrderMainNumberDigits" Module="In-Commerce" Type="1">T3JkZXIgbWFpbiBudW1iZXIgZGlnaXRz</PHRASE>
<PHRASE Label="la_OrderSecNumberDigits" Module="In-Commerce" Type="1">T3JkZXIgc3VibnVtYmVyIGRpZ2l0cw==</PHRASE>
<PHRASE Label="la_OrderSubtotal" Module="In-Commerce" Type="1">U3VidG90YWw=</PHRASE>
<PHRASE Label="la_orders_NextOrderNumber" Module="In-Commerce" Type="1">TmV4dCBPcmRlciBOdW1iZXI=</PHRASE>
<PHRASE Label="la_orders_RequireLogin" Module="In-Commerce" Type="1">UmVxdWlyZSBsb2dpbiBiZWZvcmUgY2hlY2tvdXQ=</PHRASE>
<PHRASE Label="la_Order_Billing_Information" Module="In-Commerce" Type="1">T3JkZXIgQmlsbGluZyBJbmZvcm1hdGlvbg==</PHRASE>
<PHRASE Label="la_Order_Preview" Module="In-Commerce" Type="1">T3JkZXIgUHJldmlldw==</PHRASE>
<PHRASE Label="la_Overall" Module="In-Commerce" Type="1">T3ZlcmFsbA==</PHRASE>
<PHRASE Label="la_oz" Module="In-Commerce" Type="1">b3VuY2Vz</PHRASE>
<PHRASE Label="la_PAB" Module="In-Commerce" Type="1">QmFsYm9h</PHRASE>
<PHRASE Label="la_PEN" Module="In-Commerce" Type="1">TnVldm8gU29s</PHRASE>
<PHRASE Label="la_Percent" Module="In-Commerce" Type="1">UGVyY2VudA==</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliates.advanced:approve" Module="In-Commerce" Type="1">RW5hYmxlIEFmZmlsaWF0ZXM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliates.advanced:decline" Module="In-Commerce" Type="1">RGlzYWJsZSBBZmZpbGlhdGVz</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliate_payment_types.advanced:approve" Module="In-Commerce" Type="1">RW5hYmxlIEFmZmlsaWF0ZSBQYXltZW50IFR5cGU=</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliate_payment_types.advanced:decline" Module="In-Commerce" Type="1">RGlzYWJsZSBBZmZpbGlhdGUgUGF5bWVudCBUeXBl</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliate_payment_types.advanced:move_down" Module="In-Commerce" Type="1">TW92ZS1kb3duIEFmZmlsaWF0ZSBQYXltZW50IFR5cGU=</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliate_payment_types.advanced:move_up" Module="In-Commerce" Type="1">TW92ZS11cCBBZmZpbGlhdGUgUGF5bWVudCBUeXBl</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliate_payment_types.advanced:set_primary" Module="In-Commerce" Type="1">U2V0IFByaW1hcnkgQWZmaWxpYXRlIFBheW1lbnQgVHlwZQ==</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliate_plans.advanced:approve" Module="In-Commerce" Type="1">RW5hYmxlIEFmZmlsaWF0ZSBQbGFucw==</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliate_plans.advanced:decline" Module="In-Commerce" Type="1">RGlzYWJsZSBBZmZpbGlhdGUgUGxhbnM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:affiliate_plans.advanced:set_primary" Module="In-Commerce" Type="1">U2V0IFByaW1hcnkgQWZmaWxpYXRlIFBsYW4=</PHRASE>
<PHRASE Label="la_permission_in-commerce:coupons.advanced:approve" Module="In-Commerce" Type="1">RW5hYmxlIENvdXBvbnM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:coupons.advanced:decline" Module="In-Commerce" Type="1">RGlzYWJsZSBDb3Vwb25z</PHRASE>
<PHRASE Label="la_permission_in-commerce:currencies.advanced:move_down" Module="In-Commerce" Type="1">TW92ZS1kb3duIFByaW9yaXR5IGZvciBDdXJyZW5jeQ==</PHRASE>
<PHRASE Label="la_permission_in-commerce:currencies.advanced:move_up" Module="In-Commerce" Type="1">TW92ZS11cCBQcmlvcml0eSBmb3IgQ3VycmVuY3k=</PHRASE>
<PHRASE Label="la_permission_in-commerce:currencies.advanced:set_primary" Module="In-Commerce" Type="1">U2V0IFByaW1hcnkgQ3VycmVuY3k=</PHRASE>
<PHRASE Label="la_permission_in-commerce:currencies.advanced:update_rate" Module="In-Commerce" Type="1">VXBkYXRlIEN1cnJlbmN5IFJhdGVz</PHRASE>
<PHRASE Label="la_permission_in-commerce:discounts.advanced:approve" Module="In-Commerce" Type="1">RW5hYmxlIERpc2NvdW50cw==</PHRASE>
<PHRASE Label="la_permission_in-commerce:discounts.advanced:decline" Module="In-Commerce" Type="1">RGlzYWJsZSBEaXNjb3VudHM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:gift-certificates.advanced:approve" Module="In-Commerce" Type="1">RW5hYmxlIEdpZnQgQ2VydGlmaWNhdGVz</PHRASE>
<PHRASE Label="la_permission_in-commerce:gift-certificates.advanced:decline" Module="In-Commerce" Type="1">RGlzYWJsZSBHaWZ0IENlcnRpZmljYXRlcw==</PHRASE>
<PHRASE Label="la_permission_in-commerce:orders.advanced:approve" Module="In-Commerce" Type="1">QXBwcm92ZSBPcmRlcnM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:orders.advanced:archive" Module="In-Commerce" Type="1">QXJjaGl2ZSBPcmRlcnM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:orders.advanced:deny" Module="In-Commerce" Type="1">RGVueSBPcmRlcnM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:orders.advanced:place" Module="In-Commerce" Type="1">UGxhY2UgT3JkZXJz</PHRASE>
<PHRASE Label="la_permission_in-commerce:orders.advanced:process" Module="In-Commerce" Type="1">UHJvY2VzcyBPcmRlcnM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:orders.advanced:reset_to_pending" Module="In-Commerce" Type="1">UmVzZXQgT3JkZXJzIHRvIFBlbmRpbmc=</PHRASE>
<PHRASE Label="la_permission_in-commerce:orders.advanced:ship" Module="In-Commerce" Type="1">U2hpcCBPcmRlcnM=</PHRASE>
<PHRASE Label="la_permission_in-commerce:shipping.advanced:approve" Module="In-Commerce" Type="1">RW5hYmxlIFNoaXBwaW5nIFR5cGU=</PHRASE>
<PHRASE Label="la_permission_in-commerce:shipping.advanced:decline" Module="In-Commerce" Type="1">RGlzYWJsZSBTaGlwcGluZyBUeXBl</PHRASE>
<PHRASE Label="la_permission_in-commerce:shipping_quote_engines.advanced:approve" Module="In-Commerce" Type="1">RW5hYmxlIFNoaXBwaW5nIFF1b3RpbmcgRW5naW5lcw==</PHRASE>
<PHRASE Label="la_permission_in-commerce:shipping_quote_engines.advanced:decline" Module="In-Commerce" Type="1">RGlzYWJsZSBTaGlwcGluZyBRdW90aW5nIEVuZ2luZXM=</PHRASE>
<PHRASE Label="la_PermName_Product.Add_desc" Module="In-Commerce" Type="1">QWRkIFByb2R1Y3Q=</PHRASE>
<PHRASE Label="la_PermName_Product.Delete_desc" Module="In-Commerce" Type="1">RGVsZXRlIFByb2R1Y3Q=</PHRASE>
<PHRASE Label="la_PermName_Product.Modify_desc" Module="In-Commerce" Type="1">TW9kaWZ5IFByb2R1Y3Q=</PHRASE>
<PHRASE Label="la_PermName_Product.Rate_desc" Module="In-Commerce" Type="1">UmF0ZSBQcm9kdWN0</PHRASE>
<PHRASE Label="la_PermName_Product.Review_desc" Module="In-Commerce" Type="1">Q29tbWVudCBQcm9kdWN0</PHRASE>
<PHRASE Label="la_PermName_Product.Review_Pending_desc" Module="In-Commerce" Type="1">Q29tbWVudCBQcm9kdWN0IFBlbmRpbmc=</PHRASE>
<PHRASE Label="la_PermName_Product.View_desc" Module="In-Commerce" Type="1">VmlldyBQcm9kdWN0</PHRASE>
<PHRASE Label="la_Perpage_Manufacturers" Module="In-Commerce" Type="1">TWFudWZhY3R1cmVycyBwZXIgcGFnZQ==</PHRASE>
<PHRASE Label="la_Perpage_Manufacturers_Short" Module="In-Commerce" Type="1">TWFudWZhY3R1cmVycyBwZXIgcGFnZSBvbiBhIHNob3J0IGxpc3Rpbmc=</PHRASE>
<PHRASE Label="la_Perpage_Products" Module="In-Commerce" Type="1">TnVtYmVyIG9mIHByb2R1Y3RzIHBlciBwYWdl</PHRASE>
<PHRASE Label="la_Perpage_Products_Shortlist" Module="In-Commerce" Type="1">TnVtYmVyIG9mIHByb2R1Y3RzIHBlciBwYWdlIG9uIGEgc2hvcnQgbGlzdGluZw==</PHRASE>
<PHRASE Label="la_PerUnit" Module="In-Commerce" Type="1">UGVyIFVuaXQ=</PHRASE>
<PHRASE Label="la_PGK" Module="In-Commerce" Type="1">S2luYQ==</PHRASE>
<PHRASE Label="la_PHP" Module="In-Commerce" Type="1">UGhpbGlwcGluZSBQZXNv</PHRASE>
<PHRASE Label="la_PKR" Module="In-Commerce" Type="1">UGFraXN0YW4gUnVwZWU=</PHRASE>
<PHRASE Label="la_PLN" Module="In-Commerce" Type="1">WmxvdHk=</PHRASE>
<PHRASE Label="la_Precision" Module="In-Commerce" Type="1">UHJlY2lzaW9u</PHRASE>
<PHRASE Label="la_prefix_ord" Module="In-Commerce" Type="1">T3JkZXI=</PHRASE>
<PHRASE Label="la_ProcessBackorderingAuto" Module="In-Commerce" Type="1">UHJvY2VzcyBiYWNrb3JkZXJzIGF1dG9tYXRpY2FsbHk=</PHRASE>
<PHRASE Label="la_Processed" Module="In-Commerce" Type="1">UHJvY2Vzc2Vk</PHRASE>
<PHRASE Label="la_ProcessingFee" Module="In-Commerce" Type="1">UHJvY2Vzc2luZyBGZWU=</PHRASE>
<PHRASE Label="la_Product" Module="In-Commerce" Type="1">UHJvZHVjdA==</PHRASE>
<PHRASE Label="la_ProductDeleted" Module="In-Commerce" Type="1">UHJvZHVjdCBEZWxldGVk</PHRASE>
<PHRASE Label="la_product_downloadable" Module="In-Commerce" Type="1">RG93bmxvYWRhYmxl</PHRASE>
<PHRASE Label="la_product_package" Module="In-Commerce" Type="1">UGFja2FnZQ==</PHRASE>
<PHRASE Label="la_product_service" Module="In-Commerce" Type="1">U2VydmljZQ==</PHRASE>
<PHRASE Label="la_product_subscription" Module="In-Commerce" Type="1">U3Vic2NyaXB0aW9u</PHRASE>
<PHRASE Label="la_product_tangible" Module="In-Commerce" Type="1">VGFuZ2libGU=</PHRASE>
<PHRASE Label="la_prompt_affiliate_cookie_duration" Module="In-Commerce" Type="1">QWZmaWxpYXRlIENvb2tpZSBEdXJhdGlvbiAoaW4gZGF5cyk=</PHRASE>
<PHRASE Label="la_prompt_affiliate_group" Module="In-Commerce" Type="1">QWZmaWxpYXRlIEdyb3Vw</PHRASE>
<PHRASE Label="la_prompt_affiliate_storage_method" Module="In-Commerce" Type="1">QWZmaWxpYXRlIFN0b3JhZ2UgTWV0aG9k</PHRASE>
<PHRASE Label="la_prompt_Multilingual" Module="In-Commerce" Type="1">TXVsdGlsaW5ndWFs</PHRASE>
<PHRASE Label="la_prompt_PriceBracketCalculation" Module="In-Commerce" Type="1">Q2FsY3VsYXRlIFByaWNpbmcgYnk=</PHRASE>
<PHRASE Label="la_prompt_register_as_affiliate" Module="In-Commerce" Type="1">QWxsb3cgcmVnaXN0cmF0aW9uIGFzIGFmZmlsaWF0ZQ==</PHRASE>
<PHRASE Label="la_PropagateValues" Module="In-Commerce" Type="1">UHJvcGFnYXRlIFZhbHVlcw==</PHRASE>
<PHRASE Label="la_PYG" Module="In-Commerce" Type="1">R3VhcmFuaQ==</PHRASE>
<PHRASE Label="la_QAR" Module="In-Commerce" Type="1">UWF0YXJpIFJpYWw=</PHRASE>
<PHRASE Label="la_quartely" Module="In-Commerce" Type="1">cXVhcnRlcg==</PHRASE>
<PHRASE Label="la_RecalculateOrder" Module="In-Commerce" Type="1">UmVjYWxjdWxhdGUgT3JkZXI=</PHRASE>
<PHRASE Label="la_RecurringChargeInverval" Module="In-Commerce" Type="1">Q2hhcmdlIFJlY3VycmluZyBPcmRlcnMgKGRheXMgaW4gYWR2YW5jZSk=</PHRASE>
<PHRASE Label="la_RecurringOrderDenied" Module="In-Commerce" Type="1">UmVjdXJyaW5nIE9yZGVyIERlbmllZA==</PHRASE>
<PHRASE Label="la_RecurringOrderProcessed" Module="In-Commerce" Type="1">UmVjdXJyaW5nIE9yZGVyIFByb2Nlc3NlZA==</PHRASE>
<PHRASE Label="la_ResetBackorderFlag" Module="In-Commerce" Type="1">UmVzZXQgYmFja29yZGVyIGZsYWcgYXV0b21hdGljYWxseSB3aGVuIEF2YWlsYWJsZSBxdWFudGl0eSBpcyBlcXVhbCB0bywgb3IgYWJvdmU=</PHRASE>
<PHRASE Label="la_reset_to_base" Module="In-Commerce" Type="1">UmVzZXQgVG8gQmFzZQ==</PHRASE>
<PHRASE Label="la_Right" Module="In-Commerce" Type="1">UmlnaHQ=</PHRASE>
<PHRASE Label="la_ROL" Module="In-Commerce" Type="1">TGV1</PHRASE>
<PHRASE Label="la_RUB" Module="In-Commerce" Type="1">UnVzc2lhbiBSdWJsZQ==</PHRASE>
<PHRASE Label="la_RUR" Module="In-Commerce" Type="1">UnVzc2lhbiBSdWJsZQ==</PHRASE>
<PHRASE Label="la_RWF" Module="In-Commerce" Type="1">UndhbmRhIEZyYW5j</PHRASE>
<PHRASE Label="la_SAR" Module="In-Commerce" Type="1">U2F1ZGkgUml5YWw=</PHRASE>
<PHRASE Label="la_SBD" Module="In-Commerce" Type="1">U29sb21vbiBJc2xhbmRzIERvbGxhcg==</PHRASE>
<PHRASE Label="la_SCR" Module="In-Commerce" Type="1">U2V5Y2hlbGxlcyBSdXBlZQ==</PHRASE>
<PHRASE Label="la_SDD" Module="In-Commerce" Type="1">U3VkYW5lc2UgRGluYXI=</PHRASE>
<PHRASE Label="la_section_AdvertisingMaterials" Module="In-Commerce" Type="1">QWR2ZXJ0aXNpbmcgTWF0ZXJpYWxz</PHRASE>
<PHRASE Label="la_section_Affiliate" Module="In-Commerce" Type="1">QWZmaWxpYXRl</PHRASE>
<PHRASE Label="la_section_Backordering" Module="In-Commerce" Type="1">QmFja29yZGVyaW5n</PHRASE>
<PHRASE Label="la_section_Comments" Module="In-Commerce" Type="1">Q29tbWVudHM=</PHRASE>
<PHRASE Label="la_section_CreditCard" Module="In-Commerce" Type="1">Q3JlZGl0IENhcmQ=</PHRASE>
<PHRASE Label="la_section_Currency" Module="In-Commerce" Type="1">Q3VycmVuY3k=</PHRASE>
<PHRASE Label="la_section_EmailDelivery" Module="In-Commerce" Type="1">U2VuZCB2aWEgRS1tYWlsIHRv</PHRASE>
- <PHRASE Label="la_section_File" Module="In-Commerce" Type="1">RmlsZQ==</PHRASE>
<PHRASE Label="la_section_Files" Module="In-Commerce" Type="1">RmlsZXM=</PHRASE>
<PHRASE Label="la_section_help_file_missing" Module="In-Commerce" Type="1">IFRoaXMgaGVscCBzZWN0aW9uIGRvZXMgbm90IHlldCBleGlzdCwgaXQncyBjb21pbmcgc29vbiE=</PHRASE>
<PHRASE Label="la_section_OrderBilling" Module="In-Commerce" Type="1">QmlsbGluZyBJbmZvcm1hdGlvbg==</PHRASE>
<PHRASE Label="la_section_OrderShipping" Module="In-Commerce" Type="1">U2hpcHBpbmcgSW5mb3JtYXRpb24=</PHRASE>
<PHRASE Label="la_section_PostalDelivery" Module="In-Commerce" Type="1">U2VuZCB2aWEgUG9zdGFsIE1haWwgdG8=</PHRASE>
<PHRASE Label="la_section_PriceBracket" Module="In-Commerce" Type="1">UHJpY2UgQnJhY2tldA==</PHRASE>
<PHRASE Label="la_section_Product" Module="In-Commerce" Type="1">UHJvZHVjdA==</PHRASE>
<PHRASE Label="la_section_ShippingCosts" Module="In-Commerce" Type="1">U2hpcHBpbmcgQ29zdHM=</PHRASE>
<PHRASE Label="la_section_ShippingZone" Module="In-Commerce" Type="1">U2hpcHBpbmcgWm9uZQ==</PHRASE>
<PHRASE Label="la_section_Statistics" Module="In-Commerce" Type="1">U3RhdGlzdGljcw==</PHRASE>
<PHRASE Label="la_section_StoreSettings" Module="In-Commerce" Type="1">U3RvcmUgU2V0dGluZ3M=</PHRASE>
<PHRASE Label="la_section_TaxZone" Module="In-Commerce" Type="1">VGF4IFpvbmU=</PHRASE>
<PHRASE Label="la_SEK" Module="In-Commerce" Type="1">U3dlZGlzaCBLcm9uYQ==</PHRASE>
<PHRASE Label="la_SelectedOnly" Module="In-Commerce" Type="1">U2VsZWN0ZWQgUHJvZHVjdHMgT25seQ==</PHRASE>
<PHRASE Label="la_SetBackorderFlag" Module="In-Commerce" Type="1">U2V0IGJhY2tvcmRlciBmbGFnIGF1dG9tYXRpY2FsbHkgd2hlbiBBdmFpbGFibGUgcXVhbnRpdHkgaXMgZXF1YWwgdG8=</PHRASE>
<PHRASE Label="la_SGD" Module="In-Commerce" Type="1">U2luZ2Fwb3JlIERvbGxhcg==</PHRASE>
<PHRASE Label="la_ShippingHandling" Module="In-Commerce" Type="1">U2hpcHBpbmcgYW5kIEhhbmRsaW5n</PHRASE>
<PHRASE Label="la_ShippingId" Module="In-Commerce" Type="1">SUQ=</PHRASE>
<PHRASE Label="la_shipping_AnyAndSelected" Module="In-Commerce" Type="1">QW55ICsgU2VsZWN0ZWQ=</PHRASE>
<PHRASE Label="la_Shipping_Code" Module="In-Commerce" Type="1">U2hpcHBpbmcgQ29kZQ==</PHRASE>
<PHRASE Label="la_Shipping_From_Location" Module="In-Commerce" Type="1">RnJvbSBMb2NhdGlvbg==</PHRASE>
<PHRASE Label="la_shipping_Limited" Module="In-Commerce" Type="1">U2VsZWN0ZWQgT25seQ==</PHRASE>
<PHRASE Label="la_Shipping_Name" Module="In-Commerce" Type="1">TmFtZQ==</PHRASE>
<PHRASE Label="la_Shipping_Type" Module="In-Commerce" Type="1">VHlwZQ==</PHRASE>
<PHRASE Label="la_ship_All_Together" Module="In-Commerce" Type="1">U2hpcCBhbGwgaXRlbXMgdG9nZXRoZXI=</PHRASE>
<PHRASE Label="la_ship_Backorders_Upon_Avail" Module="In-Commerce" Type="1">U2hpcCBiYWNrb3JkZXJzIHVwb24gYXZhaWxhYmxl</PHRASE>
<PHRASE Label="la_ship_Backorder_Separately" Module="In-Commerce" Type="1">U2hpcCBiYWNrb3JkZXJlZCBpdGVtcyBzZXBhcmF0ZWx5</PHRASE>
<PHRASE Label="la_SHP" Module="In-Commerce" Type="1">U2FpbnQgSGVsZW5hIFBvdW5k</PHRASE>
<PHRASE Label="la_SIT" Module="In-Commerce" Type="1">VG9sYXI=</PHRASE>
<PHRASE Label="la_SKK" Module="In-Commerce" Type="1">U2xvdmFrIEtvcnVuYQ==</PHRASE>
<PHRASE Label="la_SLL" Module="In-Commerce" Type="1">TGVvbmU=</PHRASE>
<PHRASE Label="la_SOS" Module="In-Commerce" Type="1">U29tYWxpIFNoaWxsaW5n</PHRASE>
<PHRASE Label="la_Speed_Code" Module="In-Commerce" Type="1">U3BlZWQgQ29kZQ==</PHRASE>
<PHRASE Label="la_SRD" Module="In-Commerce" Type="1">U1JE</PHRASE>
<PHRASE Label="la_SRG" Module="In-Commerce" Type="1">U3VyaW5hbWUgR3VpbGRlcg==</PHRASE>
<PHRASE Label="la_StartingOrderNumber" Module="In-Commerce" Type="1">U3RhcnRpbmcgb3JkZXIgbnVtYmVy</PHRASE>
<PHRASE Label="la_State" Module="In-Commerce" Type="1">U3RhdGU=</PHRASE>
<PHRASE Label="la_STD" Module="In-Commerce" Type="1">RG9icmE=</PHRASE>
<PHRASE Label="la_StoreName" Module="In-Commerce" Type="1">TmFtZQ==</PHRASE>
<PHRASE Label="la_SubTotal" Module="In-Commerce" Type="1">U3VidG90YWw=</PHRASE>
<PHRASE Label="la_SVC" Module="In-Commerce" Type="1">RWwgU2FsdmFkb3IgQ29sb24=</PHRASE>
<PHRASE Label="la_SYP" Module="In-Commerce" Type="1">U3lyaWFuIFBvdW5k</PHRASE>
<PHRASE Label="la_SZL" Module="In-Commerce" Type="1">TGlsYW5nZW5p</PHRASE>
<PHRASE Label="la_tab_Access" Module="In-Commerce" Type="1">QWNjZXNz</PHRASE>
<PHRASE Label="la_tab_AccessAndPricing" Module="In-Commerce" Type="1">QWNjZXNzICYgUHJpY2luZw==</PHRASE>
<PHRASE Label="la_tab_Addresses" Module="In-Commerce" Type="1">QWRkcmVzc2Vz</PHRASE>
<PHRASE Label="la_tab_AffiliatePaymentTypes" Module="In-Commerce" Type="1">QWZmaWxpYXRlIFBheW1lbnQgVHlwZXM=</PHRASE>
<PHRASE Label="la_tab_AffiliatePlans" Module="In-Commerce" Type="1">QWZmaWxpYXRlIFBsYW5z</PHRASE>
<PHRASE Label="la_tab_Affiliates" Module="In-Commerce" Type="1">QWZmaWxpYXRlcw==</PHRASE>
<PHRASE Label="la_tab_Archived" Module="In-Commerce" Type="1">QXJjaGl2ZWQ=</PHRASE>
<PHRASE Label="la_tab_Backorders" Module="In-Commerce" Type="1">QmFja29yZGVycw==</PHRASE>
<PHRASE Label="la_tab_Billing" Module="In-Commerce" Type="1">QmlsbGluZw==</PHRASE>
<PHRASE Label="la_tab_Brackets" Module="In-Commerce" Type="1">QnJhY2tldHM=</PHRASE>
<PHRASE Label="la_tab_ConfigContacts" Module="In-Commerce" Type="1">Q29udGFjdCBJbmZvcm1hdGlvbg==</PHRASE>
<PHRASE Label="la_tab_Costs" Module="In-Commerce" Type="1">Q29zdHM=</PHRASE>
<PHRASE Label="la_tab_Coupons" Module="In-Commerce" Type="1">Q291cG9ucw==</PHRASE>
<PHRASE Label="la_tab_CouponsItems" Module="In-Commerce" Type="1">SXRlbXM=</PHRASE>
<PHRASE Label="la_tab_Currencies" Module="In-Commerce" Type="1">Q3VycmVuY2llcw==</PHRASE>
<PHRASE Label="la_tab_CustomShippingTypes" Module="In-Commerce" Type="1">Q3VzdG9tIFNoaXBwaW5nIFR5cGVz</PHRASE>
<PHRASE Label="la_tab_Denied" Module="In-Commerce" Type="1">RGVuaWVk</PHRASE>
<PHRASE Label="la_tab_DiscountItems" Module="In-Commerce" Type="1">SXRlbXM=</PHRASE>
<PHRASE Label="la_tab_Discounts" Module="In-Commerce" Type="1">RGlzY291bnRz</PHRASE>
<PHRASE Label="la_tab_DiscountsAndCoupons" Module="In-Commerce" Type="1">RGlzY291bnRzICYgQ2VydGlmaWNhdGVz</PHRASE>
<PHRASE Label="la_tab_DownloadLog" Module="In-Commerce" Type="1">RG93bmxvYWQgTG9n</PHRASE>
<PHRASE Label="la_tab_Editing_Shipping_type" Module="In-Commerce" Type="1">RWRpdGluZyBTaGlwcGluZyB0eXBl</PHRASE>
<PHRASE Label="la_tab_FilesAndPricing" Module="In-Commerce" Type="1">RmlsZXMgJiBQcmljaW5n</PHRASE>
<PHRASE Label="la_tab_Gateway" Module="In-Commerce" Type="1">R2F0ZXdheQ==</PHRASE>
<PHRASE Label="la_tab_GiftCertificates" Module="In-Commerce" Type="1">R2lmdCBDZXJ0aWZpY2F0ZXM=</PHRASE>
<PHRASE Label="la_tab_Incomplete" Module="In-Commerce" Type="1">SW5jb21wbGV0ZQ==</PHRASE>
<PHRASE Label="la_tab_Inventory" Module="In-Commerce" Type="1">SW52ZW50b3J5</PHRASE>
<PHRASE Label="la_tab_Manufacturers" Module="In-Commerce" Type="1">TWFudWZhY3R1cmVycw==</PHRASE>
<PHRASE Label="la_tab_NewRegional" Module="In-Commerce" Type="1">TkVXIFJlZ2lvbmFs</PHRASE>
<PHRASE Label="la_tab_Options" Module="In-Commerce" Type="1">T3B0aW9ucw==</PHRASE>
<PHRASE Label="la_tab_Orders" Module="In-Commerce" Type="1">T3JkZXJz</PHRASE>
<PHRASE Label="la_tab_PaymentLog" Module="In-Commerce" Type="1">VHJhbnNhY3Rpb25z</PHRASE>
<PHRASE Label="la_tab_Payments" Module="In-Commerce" Type="1">UGF5bWVudHM=</PHRASE>
<PHRASE Label="la_tab_PaymentTypes" Module="In-Commerce" Type="1">UGF5bWVudCBUeXBlcw==</PHRASE>
<PHRASE Label="la_tab_Pending" Module="In-Commerce" Type="1">UGVuZGluZw==</PHRASE>
<PHRASE Label="la_tab_Preview" Module="In-Commerce" Type="1">UHJldmlldw==</PHRASE>
<PHRASE Label="la_tab_Pricing" Module="In-Commerce" Type="1">UHJpY2luZw==</PHRASE>
<PHRASE Label="la_tab_Processed" Module="In-Commerce" Type="1">UHJvY2Vzc2Vk</PHRASE>
<PHRASE Label="la_tab_Products" Module="In-Commerce" Type="1">UHJvZHVjdHM=</PHRASE>
<PHRASE Label="la_tab_Returns" Module="In-Commerce" Type="1">UmV0dXJuZWQ=</PHRASE>
<PHRASE Label="la_tab_SaleReports" Module="In-Commerce" Type="1">U2FsZXMgUmVwb3J0</PHRASE>
<PHRASE Label="la_tab_Shipping" Module="In-Commerce" Type="1">U2hpcHBpbmc=</PHRASE>
<PHRASE Label="la_tab_ShippingQuoteEngines" Module="In-Commerce" Type="1">U2hpcHBpbmcgUXVvdGUgRW5naW5lcw==</PHRASE>
<PHRASE Label="la_tab_ShippingZones" Module="In-Commerce" Type="1">U2hpcHBpbmcgWm9uZXM=</PHRASE>
<PHRASE Label="la_tab_Shipping_Types" Module="In-Commerce" Type="1">RWRpdGluZyBTaGlwcGluZyBUeXBlcw==</PHRASE>
<PHRASE Label="la_tab_Taxes" Module="In-Commerce" Type="1">VGF4ZXM=</PHRASE>
<PHRASE Label="la_tab_ToShip" Module="In-Commerce" Type="1">VG8gU2hpcA==</PHRASE>
<PHRASE Label="la_tab_UserGroups" Module="In-Commerce" Type="1">VXNlciBHcm91cHM=</PHRASE>
<PHRASE Label="la_text_Additional" Module="In-Commerce" Type="1">QWRkaXRpb25hbA==</PHRASE>
<PHRASE Label="la_Text_Affiliates" Module="In-Commerce" Type="1">QWZmaWxpYXRlcw==</PHRASE>
<PHRASE Label="la_Text_Carriers" Module="In-Commerce" Type="1">Q2FycmllcnM=</PHRASE>
<PHRASE Label="la_Text_Combination" Module="In-Commerce" Type="1">Q29tYmluYXRpb24=</PHRASE>
<PHRASE Label="la_text_CompanyName" Module="In-Commerce" Type="1">Q29tcGFueSBOYW1l</PHRASE>
<PHRASE Label="la_text_ContactName" Module="In-Commerce" Type="1">Q29udGFjdCBOYW1l</PHRASE>
<PHRASE Label="la_Text_ContactsGeneral" Module="In-Commerce" Type="1">R2VuZXJhbCBjb250YWN0IGluZm9ybWF0aW9u</PHRASE>
<PHRASE Label="la_Text_Coupons" Module="In-Commerce" Type="1">Q291cG9ucw==</PHRASE>
<PHRASE Label="la_Text_Currencies" Module="In-Commerce" Type="1">Q3VycmVuY2llcw==</PHRASE>
<PHRASE Label="la_Text_Delivery" Module="In-Commerce" Type="1">RGVsaXZlcnk=</PHRASE>
<PHRASE Label="la_text_Fax" Module="In-Commerce" Type="1">RmF4</PHRASE>
<PHRASE Label="la_Text_Manufacturers" Module="In-Commerce" Type="1">TWFudWZhY3R1cmVycw==</PHRASE>
<PHRASE Label="la_Text_Option" Module="In-Commerce" Type="1">T3B0aW9u</PHRASE>
<PHRASE Label="la_Text_Orders" Module="In-Commerce" Type="1">T3JkZXJz</PHRASE>
<PHRASE Label="la_Text_Other" Module="In-Commerce" Type="1">T3RoZXI=</PHRASE>
<PHRASE Label="la_text_Others" Module="In-Commerce" Type="1">T3RoZXJz</PHRASE>
<PHRASE Label="la_Text_PricingCalculation" Module="In-Commerce" Type="1">UHJpY2UgQnJha2V0IENhbGN1bGF0aW9u</PHRASE>
<PHRASE Label="la_text_Product" Module="In-Commerce" Type="1">UHJvZHVjdA==</PHRASE>
<PHRASE Label="la_Text_Products" Module="In-Commerce" Type="1">UHJvZHVjdHM=</PHRASE>
<PHRASE Label="la_Text_Properties" Module="In-Commerce" Type="1">UHJvcGVydGllcw==</PHRASE>
<PHRASE Label="la_text_ReportByTopProductCategories" Module="In-Commerce" Type="1">UHJvZHVjdCBDYXRlZ29yaWVzIGJ5</PHRASE>
<PHRASE Label="la_text_ReportByTopProducts" Module="In-Commerce" Type="1">UHJvZHVjdHMgYnk=</PHRASE>
<PHRASE Label="la_Text_ShippingAddress" Module="In-Commerce" Type="1">U2hpcHBpbmcgRnJvbSBhZGRyZXNz</PHRASE>
<PHRASE Label="la_Text_Shipping_Type" Module="In-Commerce" Type="1">U2hpcHBpbmcgVHlwZQ==</PHRASE>
<PHRASE Label="la_Text_StoreAddress" Module="In-Commerce" Type="1">Q29udGFjdCBBZGRyZXNz</PHRASE>
<PHRASE Label="la_text_StoreName" Module="In-Commerce" Type="1">U3RvcmUgTmFtZQ==</PHRASE>
<PHRASE Label="la_Text_TopSellers" Module="In-Commerce" Type="1">VG9wIHNlbGxlcnM=</PHRASE>
<PHRASE Label="la_THB" Module="In-Commerce" Type="1">QmFodA==</PHRASE>
<PHRASE Label="la_title_AddingAddress" Module="In-Commerce" Type="1">QWRkaW5nIEFkZHJlc3M=</PHRASE>
<PHRASE Label="la_title_AddingCurrency" Module="In-Commerce" Type="1">QWRkaW5nIEN1cnJlbmN5</PHRASE>
<PHRASE Label="la_title_AddingGiftCertificate" Module="In-Commerce" Type="1">QWRkaW5nIEdpZnQgQ2VydGlmaWNhdGU=</PHRASE>
<PHRASE Label="la_title_AddingManufacturer" Module="In-Commerce" Type="1">QWRkaW5nIG1hbnVmYWN0dXJlcg==</PHRASE>
<PHRASE Label="la_title_AddingPaymentType" Module="In-Commerce" Type="1">QWRkaW5nIFBheW1lbnQgVHlwZQ==</PHRASE>
<PHRASE Label="la_title_AddingShippingType" Module="In-Commerce" Type="1">QWRkaW5nIFNoaXBwaW5nIFR5cGU=</PHRASE>
<PHRASE Label="la_title_AddingShippingZone" Module="In-Commerce" Type="1">QWRkaW5nIFNoaXBwaW5nIFpvbmU=</PHRASE>
<PHRASE Label="la_title_AddingTaxZone" Module="In-Commerce" Type="1">QWRkaW5nIFRheCBab25l</PHRASE>
<PHRASE Label="la_title_Adding_Affiliate" Module="In-Commerce" Type="1">QWRkaW5nIEFmZmlsaWF0ZQ==</PHRASE>
<PHRASE Label="la_title_Adding_Affiliate_Payment_Type" Module="In-Commerce" Type="1">QWRkaW5nIEFmZmlsaWF0ZSBQYXltZW50IFR5cGU=</PHRASE>
<PHRASE Label="la_title_Adding_Affiliate_Plan" Module="In-Commerce" Type="1">QWRkaW5nIEFmZmlsaWF0ZSBQbGFu</PHRASE>
<PHRASE Label="la_title_Adding_Coupon" Module="In-Commerce" Type="1">QWRkaW5nIENvdXBvbg==</PHRASE>
<PHRASE Label="la_title_Adding_Discount" Module="In-Commerce" Type="1">QWRkaW5nIERpc2NvdW50</PHRASE>
<PHRASE Label="la_title_Adding_File" Module="In-Commerce" Type="1">QWRkaW5nIEZpbGU=</PHRASE>
<PHRASE Label="la_title_Adding_Option" Module="In-Commerce" Type="1">QWRkaW5nIE9wdGlvbg==</PHRASE>
<PHRASE Label="la_title_Adding_Order" Module="In-Commerce" Type="1">QWRkaW5nIE9yZGVy</PHRASE>
<PHRASE Label="la_title_Adding_PriceBracket" Module="In-Commerce" Type="1">QWRkaW5nIFByaWNlIEJyYWNrZXQ=</PHRASE>
<PHRASE Label="la_title_Adding_Product" Module="In-Commerce" Type="1">QWRkaW5nIFByb2R1Y3Q=</PHRASE>
<PHRASE Label="la_title_Addresses" Module="In-Commerce" Type="1">QWRkcmVzc2Vz</PHRASE>
<PHRASE Label="la_title_AffiliatePayments" Module="In-Commerce" Type="1">QWZmaWxpYXRlIFBheW1lbnRz</PHRASE>
<PHRASE Label="la_title_AffiliatePaymentTypes" Module="In-Commerce" Type="1">QWZmaWxpYXRlIFBheW1lbnQgVHlwZXM=</PHRASE>
<PHRASE Label="la_title_AffiliatePlans" Module="In-Commerce" Type="1">QWZmaWxpYXRlIFBsYW5z</PHRASE>
<PHRASE Label="la_title_AffiliatePlansBrackets" Module="In-Commerce" Type="1">QnJhY2tldHM=</PHRASE>
<PHRASE Label="la_title_Affiliates" Module="In-Commerce" Type="1">QWZmaWxpYXRlcw==</PHRASE>
<PHRASE Label="la_title_ApplyModifier" Module="In-Commerce" Type="1">QXBwbHkgTW9kaWZpZXI=</PHRASE>
<PHRASE Label="la_title_BackOrders" Module="In-Commerce" Type="1">QmFja29yZGVycyBMaXN0</PHRASE>
<PHRASE Label="la_title_Brackets" Module="In-Commerce" Type="1">QnJhY2tldHM=</PHRASE>
<PHRASE Label="la_title_Costs" Module="In-Commerce" Type="1">Q29zdHM=</PHRASE>
<PHRASE Label="la_title_CouponItems" Module="In-Commerce" Type="1">Q291cG9uIEl0ZW1z</PHRASE>
<PHRASE Label="la_title_Coupons" Module="In-Commerce" Type="1">Q291cG9ucw==</PHRASE>
<PHRASE Label="la_title_CouponSelector" Module="In-Commerce" Type="1">Q291cG9uIFNlbGVjdG9y</PHRASE>
<PHRASE Label="la_title_Currencies" Module="In-Commerce" Type="1">Q3VycmVuY2llcw==</PHRASE>
<PHRASE Label="la_title_DiscountItems" Module="In-Commerce" Type="1">RGlzY291bnQgSXRlbXM=</PHRASE>
<PHRASE Label="la_title_Discounts" Module="In-Commerce" Type="1">RGlzY291bnRz</PHRASE>
<PHRASE Label="la_title_EditingAddress" Module="In-Commerce" Type="1">RWRpdGluZyBBZGRyZXNz</PHRASE>
<PHRASE Label="la_title_EditingCurrency" Module="In-Commerce" Type="1">RWRpdGluZyBDdXJyZW5jeQ==</PHRASE>
<PHRASE Label="la_title_EditingGiftCertificate" Module="In-Commerce" Type="1">RWRpdGluZyBHaWZ0IENlcnRpZmljYXRl</PHRASE>
<PHRASE Label="la_title_EditingManufacturer" Module="In-Commerce" Type="1">RWRpdGluZyBNYW51ZmFjdHVyZXI=</PHRASE>
<PHRASE Label="la_title_EditingPaymentType" Module="In-Commerce" Type="1">RWRpdGluZyBQYXltZW50IFR5cGU=</PHRASE>
<PHRASE Label="la_title_EditingShippingQuoteEngine" Module="In-Commerce" Type="1">RWRpdGluZyBTaGlwcGluZyBRdW90ZSBFbmdpbmU=</PHRASE>
<PHRASE Label="la_title_EditingShippingType" Module="In-Commerce" Type="1">RWRpdGluZyBTaGlwcGluZyBUeXBl</PHRASE>
<PHRASE Label="la_title_EditingShippingZone" Module="In-Commerce" Type="1">RWRpdGluZyBTaGlwcGluZyBab25l</PHRASE>
<PHRASE Label="la_title_EditingTaxZone" Module="In-Commerce" Type="1">RWRpdGluZyBUYXggWm9uZQ==</PHRASE>
<PHRASE Label="la_title_Editing_Affiliate" Module="In-Commerce" Type="1">RWRpdGluZyBBZmZpbGlhdGU=</PHRASE>
<PHRASE Label="la_title_Editing_Affiliate_Payment_Type" Module="In-Commerce" Type="1">RWRpdGluZyBBZmZpbGlhdGUgUGF5bWVudCBUeXBl</PHRASE>
<PHRASE Label="la_title_Editing_Affiliate_Plan" Module="In-Commerce" Type="1">RWRpdGluZyBBZmZpbGlhdGUgUGxhbg==</PHRASE>
<PHRASE Label="la_title_Editing_Coupon" Module="In-Commerce" Type="1">RWRpdGluZyBDb3Vwb24=</PHRASE>
<PHRASE Label="la_title_Editing_Discount" Module="In-Commerce" Type="1">RWRpdGluZyBEaXNjb3VudA==</PHRASE>
<PHRASE Label="la_title_Editing_File" Module="In-Commerce" Type="1">RWRpdGluZyBGaWxl</PHRASE>
<PHRASE Label="la_title_Editing_Option" Module="In-Commerce" Type="1">RWRpdGluZyBPcHRpb24=</PHRASE>
<PHRASE Label="la_title_Editing_Order" Module="In-Commerce" Type="1">RWRpdGluZyBPcmRlcg==</PHRASE>
<PHRASE Label="la_title_Editing_Order_Item" Module="In-Commerce" Type="1">RWRpdGluZyBPcmRlciBJdGVt</PHRASE>
<PHRASE Label="la_title_Editing_PriceBracket" Module="In-Commerce" Type="1">RWRpdGluZyBQcmljZSBCcmFja2V0</PHRASE>
<PHRASE Label="la_title_Editing_Product" Module="In-Commerce" Type="1">RWRpdGluZyBQcm9kdWN0</PHRASE>
<PHRASE Label="la_title_FileDownloads" Module="In-Commerce" Type="1">RmlsZSBEb3dubG9hZHM=</PHRASE>
<PHRASE Label="la_title_Gateway" Module="In-Commerce" Type="1">R2F0ZXdheQ==</PHRASE>
<PHRASE Label="la_title_GiftCertificates" Module="In-Commerce" Type="1">R2lmdCBDZXJ0aWZpY2F0ZXM=</PHRASE>
<PHRASE Label="la_title_ImportProducts" Module="In-Commerce" Type="1">SW1wb3J0IFByb2R1Y3Rz</PHRASE>
<PHRASE Label="la_title_In-Commerce" Module="In-Commerce" Type="1">RS1jb21tZXJjZQ==</PHRASE>
<PHRASE Label="la_title_IncompleteOrders" Module="In-Commerce" Type="1">SW5jb21wbGV0ZSBPcmRlcnMgTGlzdA==</PHRASE>
<PHRASE Label="la_title_ManagingOptionCombinations" Module="In-Commerce" Type="1">TWFuYWdpbmcgT3B0aW9uIENvbWJpbmF0aW9ucw==</PHRASE>
<PHRASE Label="la_title_ManagingShippingOptions" Module="In-Commerce" Type="1">TWFuYWdlIFNoaXBwaW5nIFR5cGVz</PHRASE>
<PHRASE Label="la_title_Manufacturers" Module="In-Commerce" Type="1">TWFudWZhY3R1cmVycw==</PHRASE>
<PHRASE Label="la_title_NewCurrency" Module="In-Commerce" Type="1">TmV3IEN1cnJlbmN5</PHRASE>
<PHRASE Label="la_title_NewGiftCertificate" Module="In-Commerce" Type="1">TmV3IEdpZnQgQ2VydGlmaWNhdGU=</PHRASE>
<PHRASE Label="la_title_NewManufacturer" Module="In-Commerce" Type="1">TmV3IG1hbnVmYWN0dXJlcg==</PHRASE>
<PHRASE Label="la_title_NewPaymentType" Module="In-Commerce" Type="1">TmV3IFBheW1lbnQgVHlwZQ==</PHRASE>
<PHRASE Label="la_title_NewProduct" Module="In-Commerce" Type="1">TmV3IFByb2R1Y3Q=</PHRASE>
<PHRASE Label="la_title_NewShippingType" Module="In-Commerce" Type="1">TmV3IFNoaXBwaW5nIFR5cGU=</PHRASE>
<PHRASE Label="la_title_NewShippingZone" Module="In-Commerce" Type="1">TmV3IFNoaXBwaW5nIFpvbmU=</PHRASE>
<PHRASE Label="la_title_NewTax" Module="In-Commerce" Type="1">TmV3IFRheCBab25l</PHRASE>
<PHRASE Label="la_title_New_Affiliate" Module="In-Commerce" Type="1">TmV3IEFmZmlsaWF0ZQ==</PHRASE>
<PHRASE Label="la_title_New_Affiliate_Payment_Type" Module="In-Commerce" Type="1">TmV3IEFmZmlsaWF0ZSBQYXltZW50IFR5cGU=</PHRASE>
<PHRASE Label="la_title_New_Affiliate_Plan" Module="In-Commerce" Type="1">TmV3IEFmZmlsaWF0ZSBQbGFu</PHRASE>
<PHRASE Label="la_title_New_Coupon" Module="In-Commerce" Type="1">TmV3IENvdXBvbg==</PHRASE>
<PHRASE Label="la_title_New_Discount" Module="In-Commerce" Type="1">TmV3IERpc2NvdW50</PHRASE>
<PHRASE Label="la_title_New_File" Module="In-Commerce" Type="1">TmV3IEZpbGU=</PHRASE>
<PHRASE Label="la_title_New_Option" Module="In-Commerce" Type="1">TmV3IE9wdGlvbg==</PHRASE>
<PHRASE Label="la_title_New_Order" Module="In-Commerce" Type="1">TmV3IE9yZGVy</PHRASE>
<PHRASE Label="la_title_New_PriceBracket" Module="In-Commerce" Type="1">TmV3IFByaWNlIEJyYWNrZXQ=</PHRASE>
<PHRASE Label="la_title_OrderBilling" Module="In-Commerce" Type="1">QmlsbGluZw==</PHRASE>
<PHRASE Label="la_title_OrderGWResult" Module="In-Commerce" Type="1">VHJhbnNhY3Rpb24gRGV0YWlscw==</PHRASE>
<PHRASE Label="la_title_OrderItems" Module="In-Commerce" Type="1">SXRlbXM=</PHRASE>
<PHRASE Label="la_title_OrderPreview" Module="In-Commerce" Type="1">UHJldmlldw==</PHRASE>
<PHRASE Label="la_title_Orders" Module="In-Commerce" Type="1">T3JkZXJz</PHRASE>
<PHRASE Label="la_title_OrdersArchived" Module="In-Commerce" Type="1">QXJjaGl2ZWQgT3JkZXJzIExpc3Q=</PHRASE>
<PHRASE Label="la_title_OrdersDenied" Module="In-Commerce" Type="1">RGVuaWVkIE9yZGVycyBMaXN0</PHRASE>
<PHRASE Label="la_title_OrdersExport" Module="In-Commerce" Type="1">T3JkZXJzIEV4cG9ydA==</PHRASE>
<PHRASE Label="la_title_OrderShipping" Module="In-Commerce" Type="1">U2hpcHBpbmc=</PHRASE>
<PHRASE Label="la_title_OrdersProcessed" Module="In-Commerce" Type="1">UHJvY2Vzc2VkIE9yZGVycyBMaXN0</PHRASE>
<PHRASE Label="la_title_OrdersReturns" Module="In-Commerce" Type="1">T3JkZXJzIHdpdGggUmV0dXJucw==</PHRASE>
<PHRASE Label="la_title_OrdersSearch" Module="In-Commerce" Type="1">Rm91bmQgT3JkZXJzIExpc3Q=</PHRASE>
<PHRASE Label="la_title_OrdersToShip" Module="In-Commerce" Type="1">VG8gU2hpcCBPcmRlcnMgTGlzdA==</PHRASE>
<PHRASE Label="la_title_Payments" Module="In-Commerce" Type="1">UGF5bWVudHM=</PHRASE>
<PHRASE Label="la_title_PaymentTypes" Module="In-Commerce" Type="1">UGF5bWVudCBUeXBlcw==</PHRASE>
<PHRASE Label="la_title_PayOut_To" Module="In-Commerce" Type="1">UGF5IE91dCBUbw==</PHRASE>
<PHRASE Label="la_title_PendingOrders" Module="In-Commerce" Type="1">UGVuZGluZyBPcmRlcnMgTGlzdA==</PHRASE>
<PHRASE Label="la_title_Products" Module="In-Commerce" Type="1">UHJvZHVjdHM=</PHRASE>
<PHRASE Label="la_title_ProductsExport" Module="In-Commerce" Type="1">UHJvZHVjdHMgRXhwb3J0</PHRASE>
<PHRASE Label="la_title_Product_Access" Module="In-Commerce" Type="1">QWNjZXNz</PHRASE>
<PHRASE Label="la_title_Product_AccessPricing" Module="In-Commerce" Type="1">UHJpY2luZw==</PHRASE>
<PHRASE Label="la_title_Product_Files" Module="In-Commerce" Type="1">RmlsZXM=</PHRASE>
<PHRASE Label="la_title_Product_Inventory" Module="In-Commerce" Type="1">SW52ZW50b3J5</PHRASE>
<PHRASE Label="la_title_Product_Options" Module="In-Commerce" Type="1">UHJvZHVjdCBPcHRpb25z</PHRASE>
<PHRASE Label="la_title_Product_PackageContent" Module="In-Commerce" Type="1">UGFja2FnZSBDb250ZW50</PHRASE>
<PHRASE Label="la_title_Product_Pricing" Module="In-Commerce" Type="1">UHJpY2luZw==</PHRASE>
<PHRASE Label="la_title_ReportOptions" Module="In-Commerce" Type="1">U2FsZXMgUmVwb3J0IC0gT3B0aW9ucw==</PHRASE>
<PHRASE Label="la_title_ReportResults" Module="In-Commerce" Type="1">U2FsZXMgUmVwb3J0IFJlc3VsdHM=</PHRASE>
<PHRASE Label="la_title_SalesReportChart" Module="In-Commerce" Type="1">U2FsZXMgUmVwb3J0IENoYXJ0</PHRASE>
<PHRASE Label="la_title_ShippingQuoteEngines" Module="In-Commerce" Type="1">U2hpcHBpbmcgUXVvdGUgRW5naW5lcw==</PHRASE>
<PHRASE Label="la_title_ShippingTypes" Module="In-Commerce" Type="1">U2hpcHBpbmcgVHlwZXM=</PHRASE>
<PHRASE Label="la_title_Taxes" Module="In-Commerce" Type="1">VGF4ZXM=</PHRASE>
<PHRASE Label="la_title_Zones" Module="In-Commerce" Type="1">Wm9uZXM=</PHRASE>
<PHRASE Label="la_TJS" Module="In-Commerce" Type="1">U29tb25p</PHRASE>
<PHRASE Label="la_TMM" Module="In-Commerce" Type="1">TWFuYXQ=</PHRASE>
<PHRASE Label="la_TND" Module="In-Commerce" Type="1">VHVuaXNpYW4gRGluYXI=</PHRASE>
<PHRASE Label="la_Tooltip_Add_Items" Module="In-Commerce" Type="1">QWRkIEl0ZW1z</PHRASE>
<PHRASE Label="la_ToolTip_Add_Product" Module="In-Commerce" Type="1">QWRkIFByb2R1Y3Q=</PHRASE>
<PHRASE Label="la_ToolTip_Archive" Module="In-Commerce" Type="1">QXJjaGl2ZQ==</PHRASE>
<PHRASE Label="la_tooltip_Arrange" Module="In-Commerce" Type="1">QXJyYW5nZQ==</PHRASE>
<PHRASE Label="la_tooltip_ClearAll" Module="In-Commerce" Type="1">Q2xlYXIgQWxs</PHRASE>
<PHRASE Label="la_tooltip_EntireOrder" Module="In-Commerce" Type="1">RW50aXJlIE9yZGVy</PHRASE>
<PHRASE Label="la_tooltip_Flip" Module="In-Commerce" Type="1">RmxpcA==</PHRASE>
<PHRASE Label="la_ToolTip_GoToOrder" Module="In-Commerce" Type="1">R28gdG8gT3JkZXI=</PHRASE>
<PHRASE Label="la_tooltip_Infinity" Module="In-Commerce" Type="1">SW5maW5pdHk=</PHRASE>
<PHRASE Label="la_tooltip_Modify" Module="In-Commerce" Type="1">TW9kaWZ5</PHRASE>
<PHRASE Label="la_tooltip_MoreBrackets" Module="In-Commerce" Type="1">TW9yZSBCcmFja2V0cw==</PHRASE>
<PHRASE Label="la_ToolTip_NewAddress" Module="In-Commerce" Type="1">TmV3IEFkZHJlc3M=</PHRASE>
<PHRASE Label="la_ToolTip_NewAffiliatePaymentType" Module="In-Commerce" Type="1">TmV3IEFmZmlsaWF0ZSBQYXltZW50IFR5cGU=</PHRASE>
<PHRASE Label="la_ToolTip_NewGiftCertificate" Module="In-Commerce" Type="1">TmV3IEdpZnQgQ2VydGlmaWNhdGU=</PHRASE>
<PHRASE Label="la_tooltip_NewManufacturer" Module="In-Commerce" Type="1">TmV3IE1hbnVmYWN0dXJlcg==</PHRASE>
<PHRASE Label="la_ToolTip_NewOption" Module="In-Commerce" Type="1">TmV3IE9wdGlvbg==</PHRASE>
<PHRASE Label="la_tooltip_NewPaymentType" Module="In-Commerce" Type="1">TmV3IFBheW1lbnQgVHlwZQ==</PHRASE>
<PHRASE Label="la_ToolTip_NewPricing" Module="In-Commerce" Type="1">TmV3IFByaWNpbmc=</PHRASE>
<PHRASE Label="la_tooltip_newproduct" Module="In-Commerce" Type="1">TmV3IFByb2R1Y3Q=</PHRASE>
<PHRASE Label="la_ToolTip_NewShipZone" Module="In-Commerce" Type="1">TmV3IFNoaXBwaW5nIFpvbmU=</PHRASE>
<PHRASE Label="la_ToolTip_NewTaxZone" Module="In-Commerce" Type="1">TmV3IFRheCBab25l</PHRASE>
<PHRASE Label="la_ToolTip_New_Affiliate" Module="In-Commerce" Type="1">TmV3IEFmZmlsaWF0ZQ==</PHRASE>
<PHRASE Label="la_ToolTip_New_Affiliate_Plan" Module="In-Commerce" Type="1">TmV3IEFmZmlsaWF0ZSBQbGFu</PHRASE>
<PHRASE Label="la_tooltip_New_Coupon" Module="In-Commerce" Type="1">TmV3IENvdXBvbg==</PHRASE>
<PHRASE Label="la_tooltip_New_Discount" Module="In-Commerce" Type="1">TmV3IERpc2NvdW50</PHRASE>
<PHRASE Label="la_ToolTip_New_Order" Module="In-Commerce" Type="1">TmV3IE9yZGVy</PHRASE>
<PHRASE Label="la_ToolTip_New_PricingLimit" Module="In-Commerce" Type="1">TmV3IFByaWNpbmcgTGltaXQ=</PHRASE>
<PHRASE Label="la_tooltip_new_products" Module="In-Commerce" Type="1">QWRkIG5ldyBwcm9kdWN0cw==</PHRASE>
<PHRASE Label="la_tooltip_new_shipping" Module="In-Commerce" Type="1">TmV3IFNoaXBwaW5nIHR5cGU=</PHRASE>
<PHRASE Label="la_tooltip_new_Zone" Module="In-Commerce" Type="1">TmV3IFpvbmU=</PHRASE>
<PHRASE Label="la_ToolTip_PayOut" Module="In-Commerce" Type="1">UGF5IE91dA==</PHRASE>
<PHRASE Label="la_Tooltip_Pdf" Module="In-Commerce" Type="1">UERG</PHRASE>
<PHRASE Label="la_tooltip_PlaceOrder" Module="In-Commerce" Type="1">UGxhY2UgT3JkZXI=</PHRASE>
<PHRASE Label="la_Tooltip_Process" Module="In-Commerce" Type="1">UHJvY2Vzcw==</PHRASE>
<PHRASE Label="la_Tooltip_ResetToBilling" Module="In-Commerce" Type="1">UmVzZXQgVG8gQmlsbGluZw==</PHRASE>
<PHRASE Label="la_ToolTip_ResetToPending" Module="In-Commerce" Type="1">UmVzZXQgVG8gUGVuZGluZw==</PHRASE>
<PHRASE Label="la_ToolTip_ResetToShipping" Module="In-Commerce" Type="1">UmVzZXQgVG8gU2hpcHBpbmc=</PHRASE>
<PHRASE Label="la_Tooltip_ResetToUser" Module="In-Commerce" Type="1">UmVzZXQgVG8gVXNlcg==</PHRASE>
<PHRASE Label="la_tooltip_RunReport" Module="In-Commerce" Type="1">UnVuIFJlcG9ydA==</PHRASE>
<PHRASE Label="la_ToolTip_SaveAndPrint" Module="In-Commerce" Type="1">U2F2ZSAmIFByaW50</PHRASE>
<PHRASE Label="la_Tooltip_Ship" Module="In-Commerce" Type="1">U2hpcA==</PHRASE>
<PHRASE Label="la_ToolTip_UpdateRates" Module="In-Commerce" Type="1">VXBkYXRlIFJhdGVz</PHRASE>
<PHRASE Label="la_tooltip_view_chart" Module="In-Commerce" Type="1">VmlldyBDaGFydA==</PHRASE>
<PHRASE Label="la_TOP" Module="In-Commerce" Type="1">UGFgYW5nYQ==</PHRASE>
<PHRASE Label="la_ToShip" Module="In-Commerce" Type="1">VG8gU2hpcA==</PHRASE>
<PHRASE Label="la_TotalSavings" Module="In-Commerce" Type="1">VG90YWwgU2F2aW5ncw==</PHRASE>
<PHRASE Label="la_TPE" Module="In-Commerce" Type="1">VGltb3IgRXNjdWRv</PHRASE>
<PHRASE Label="la_TRL" Module="In-Commerce" Type="1">VHVya2lzaCBMaXJh</PHRASE>
<PHRASE Label="la_TRY" Module="In-Commerce" Type="1">VFJZ</PHRASE>
<PHRASE Label="la_TTD" Module="In-Commerce" Type="1">VHJpbmlkYWQgYW5kIFRvYmFnbyBEb2xsYXI=</PHRASE>
<PHRASE Label="la_TWD" Module="In-Commerce" Type="1">TmV3IFRhaXdhbiBEb2xsYXI=</PHRASE>
<PHRASE Label="la_Txt_=" Module="In-Commerce" Type="1">RXF1YWxz</PHRASE>
<PHRASE Label="la_TZS" Module="In-Commerce" Type="1">VGFuemFuaWFuIFNoaWxsaW5n</PHRASE>
<PHRASE Label="la_UAH" Module="In-Commerce" Type="1">SHJ5dm5pYQ==</PHRASE>
<PHRASE Label="la_UGX" Module="In-Commerce" Type="1">VWdhbmRhIFNoaWxsaW5n</PHRASE>
<PHRASE Label="la_UpdateRate" Module="In-Commerce" Type="1">VXBkYXRlIFJhdGUgVG8gUHJpbWFyeQ==</PHRASE>
<PHRASE Label="la_USD" Module="In-Commerce" Type="1">VVMgRG9sbGFy</PHRASE>
<PHRASE Label="la_Used" Module="In-Commerce" Type="1">VXNlZA==</PHRASE>
<PHRASE Label="la_UserDefined" Module="In-Commerce" Type="1">VXNlciBEZWZpbmVk</PHRASE>
<PHRASE Label="la_USN" Module="In-Commerce" Type="1">VVMgRG9sbGFyIChOZXh0IGRheSk=</PHRASE>
<PHRASE Label="la_USS" Module="In-Commerce" Type="1">VVMgRG9sbGFyIChTYW1lIGRheSk=</PHRASE>
<PHRASE Label="la_UYU" Module="In-Commerce" Type="1">UGVzbyBVcnVndWF5bw==</PHRASE>
<PHRASE Label="la_UZS" Module="In-Commerce" Type="1">VXpiZWtpc3RhbiBTdW0=</PHRASE>
<PHRASE Label="la_VAT" Module="In-Commerce" Type="1">U2FsZXMgVGF4L1ZBVA==</PHRASE>
<PHRASE Label="la_VEB" Module="In-Commerce" Type="1">Qm9saXZhcg==</PHRASE>
<PHRASE Label="la_ViewLabel" Module="In-Commerce" Type="1">VmlldyBMYWJlbA==</PHRASE>
<PHRASE Label="la_VND" Module="In-Commerce" Type="1">RG9uZw==</PHRASE>
<PHRASE Label="la_VUV" Module="In-Commerce" Type="1">VmF0dQ==</PHRASE>
<PHRASE Label="la_WarningCurrenciesNotUsed" Module="In-Commerce" Type="1">Rm9sbG93aW5nIGN1cnJlbmNpZXMgYXJlIG5vdCBzdXBwb3J0ZWQgaW4gYW55IHBheW1lbnQgdHlwZXM=</PHRASE>
<PHRASE Label="la_WarningRemoveUnusedCurrencies" Module="In-Commerce" Type="1">V291bGQgeW91IGxpa2UgdG8gZGlzYWJsZSB0aGVt</PHRASE>
<PHRASE Label="la_warning_ChangeInventoryStatus" Module="In-Commerce" Type="1">QXJlIHlvdSBzdXJlIHlvdSB3YW50IHRvIGNoYW5nZSBJbnZlbnRvcnkgU3RhdHVzPyBDaGFuZ2luZyB0aGUgc3RhdHVzIG1heSBhZmZlY3QgY3VycmVudCBvcmRlcnMgYW5kIHByb2R1Y3QgcXVhbnRpdGllcy4=</PHRASE>
<PHRASE Label="la_warning_SelectOptionCombination" Module="In-Commerce" Type="1">U2VsZWN0IG9wdGlvbiBjb21iaW5hdGlvbiB0byB1c2U=</PHRASE>
<PHRASE Label="la_warning_UpdateAllCurrencyRates" Module="In-Commerce" Type="1">RG8geW91IHdhbnQgdG8gdXBkYXRlIGFsbCByYXRlcw==</PHRASE>
<PHRASE Label="la_warning_UpdateSelectedCurrencyRates" Module="In-Commerce" Type="1">QXJlIHlvdSBzdXJlIHlvdSB3YW50IHRvIHVwZGF0ZSB0aGUgc2VsZWN0ZWQgcmF0ZXM=</PHRASE>
<PHRASE Label="la_WholeOrder" Module="In-Commerce" Type="1">V2hvbGUgT3JkZXI=</PHRASE>
<PHRASE Label="la_WST" Module="In-Commerce" Type="1">VGFsYQ==</PHRASE>
<PHRASE Label="la_XAF" Module="In-Commerce" Type="1">Q0ZBIEZyYW5jIEJFQUM=</PHRASE>
<PHRASE Label="la_XCD" Module="In-Commerce" Type="1">RWFzdCBDYXJpYmJlYW4gRG9sbGFy</PHRASE>
<PHRASE Label="la_XDR" Module="In-Commerce" Type="1">WERS</PHRASE>
<PHRASE Label="la_XOF" Module="In-Commerce" Type="1">Q0ZBIEZyYW5jIEJDRUFP</PHRASE>
<PHRASE Label="la_XPF" Module="In-Commerce" Type="1">Q0ZQIEZyYW5j</PHRASE>
<PHRASE Label="la_YER" Module="In-Commerce" Type="1">WWVtZW5pIFJpYWw=</PHRASE>
<PHRASE Label="la_YUM" Module="In-Commerce" Type="1">WXVnb3NsYXZpYW4gRGluYXI=</PHRASE>
<PHRASE Label="la_ZAR" Module="In-Commerce" Type="1">UmFuZA==</PHRASE>
<PHRASE Label="la_Zeros" Module="In-Commerce" Type="1">WmVyb3M=</PHRASE>
<PHRASE Label="la_ZIP" Module="In-Commerce" Type="1">WklQ</PHRASE>
<PHRASE Label="la_ZMK" Module="In-Commerce" Type="1">S3dhY2hh</PHRASE>
<PHRASE Label="la_zones_AvailableCountries" Module="In-Commerce" Type="1">QXZhaWxhYmxlIGNvdW50cmllcw==</PHRASE>
<PHRASE Label="la_zones_AvailableStates" Module="In-Commerce" Type="1">QXZhaWxhYmxlIHN0YXRlcw==</PHRASE>
<PHRASE Label="la_zones_AvailableZips" Module="In-Commerce" Type="1">QXZhaWxhYmxlIFpJUCBjb2Rlcw==</PHRASE>
<PHRASE Label="la_zones_SelectedCountries" Module="In-Commerce" Type="1">U2hpcCB0byBDb3VudHJpZXM=</PHRASE>
<PHRASE Label="la_zones_SelectedStates" Module="In-Commerce" Type="1">U2hpcCB0byBTdGF0ZXMvUHJvdmljZXM=</PHRASE>
<PHRASE Label="la_zones_SelectedZips" Module="In-Commerce" Type="1">U2hpcCB0byBaSVAgY29kZXM=</PHRASE>
<PHRASE Label="la_ZWD" Module="In-Commerce" Type="1">WmltYmFid2UgRG9sbGFy</PHRASE>
<PHRASE Label="lc_field_manufacturer" Module="In-Commerce" Type="2">TWFudWZhY3R1cmVy</PHRASE>
<PHRASE Label="lu_comm_ProfileAddressWarning" Module="In-Commerce" Type="1">VGhpcyBpcyB5b3VyIHByb2ZpbGUgYWRkcmVzcy4gSXQgd2lsbCBiZSB1cGRhdGVkIGlmIHlvdSBlZGl0IHRoZSBhZGRyZXNzIGJlbG93Lg==</PHRASE>
<PHRASE Label="lu_ship_Shipment" Module="In-Commerce" Type="1">U2hpcG1lbnQ=</PHRASE>
<PHRASE Label="lu_ship_ShippingType" Module="In-Commerce" Type="1">U2hpcHBpbmcgVHlwZQ==</PHRASE>
</PHRASES>
<EVENTS>
<EVENT Event="AFFILIATE.PAYMENT" Type="0">
<SUBJECT>QWZmaWxpYXRlIGNvbW1pc3Npb24gcGF5bWVudCBoYXMgYmVlbiBpc3N1ZWQ=</SUBJECT>
<HTMLBODY>WW91ciBhZmZpbGlhdGUgY29tbWlzc2lvbiBwYXltZW50IGhhcyBiZWVuIGlzc3VlZCwgcGxlYXNlIGxvZ2luIHRvIFlvdXIgQWNjb3VudCwgQWZmaWxpYXRlIFBheW1lbnRzIHNlY3Rpb24gdG8gY2hlY2sgdGhlIGRldGFpbHMu</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.PAYMENT" Type="1">
<SUBJECT>QWZmaWxpYXRlIGNvbW1pc3Npb24gcGF5bWVudCBpc3N1ZWQ=</SUBJECT>
<HTMLBODY>QWZmaWxpYXRlIGNvbW1pc3Npb24gcGF5bWVudCBoYXMgYmVlbiBpc3N1ZWQu</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.PAYMENT.TYPE.CHANGED" Type="0">
<SUBJECT>QWZmaWxpYXRlIHBheW1lbnQgdHlwZSBoYXMgY2hhbmdlZA==</SUBJECT>
<HTMLBODY>QWZmaWxpYXRlIHBheW1lbnQgdHlwZSBoYXMgY2hhbmdlZA==</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.PAYMENT.TYPE.CHANGED" Type="1">
<SUBJECT>QWZmaWxpYXRlIHBheW1lbnQgdHlwZSBjaGFuZ2Vk</SUBJECT>
<HTMLBODY>QWZmaWxpYXRlIHBheW1lbnQgdHlwZSBjaGFuZ2Vk</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.REGISTER" Type="0">
<SUBJECT>TmV3IEFmZmlsaWF0ZSBSZWdpc3RyYXRpb24=</SUBJECT>
<HTMLBODY>SGVsbG8sPGJyLz48YnIvPg0KDQpUaGFuayB5b3UgZm9yIHJlZ2lzdGVyaW5nIGFzIGFmZmlsaWF0ZS4gWW91IHdpbGwgYmUgbm90aWZpZWQgdmlhIGUtbWFpbCB3aGVuIHlvdXIgcmVnaXN0cmF0aW9uIGlzIGFwcHJvdmVkLg==</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.REGISTER" Type="1">
<SUBJECT>TmV3IEFmZmlsaWF0ZSBSZWdpc3RlcmVk</SUBJECT>
<HTMLBODY>TmV3IGFmZmlsaWF0ZSB1c2VyIGhhcyByZWdpc3RlcmVkLiBQbGVhc2UgcHJvY2VlZCB0byBBZG1pbmlzdHJhdGl2ZSBDb25zb2xlIHRvIHJldmlldyB0aGUgcmVnaXN0cmF0aW9uLg==</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.REGISTRATION.APPROVED" Type="0">
<SUBJECT>QWZmaWxpYXRlIHJlZ2lzdHJhdGlvbiBhcHByb3ZlZA==</SUBJECT>
<HTMLBODY>QWZmaWxpYXRlIHJlZ2lzdHJhdGlvbiBoYXMgYmVlbiBhcHByb3ZlZC4=</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.REGISTRATION.APPROVED" Type="1">
<SUBJECT>QWZmaWxpYXRlIHJlZ2lzdHJhdGlvbiBhcHByb3ZlZA==</SUBJECT>
<HTMLBODY>TmV3IEFmZmlsaWF0ZSByZWdpc3RyYXRpb24gaGFzIGJlZW4gYXBwcm92ZWQu</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.REGISTRATION.DENIED" Type="0">
<SUBJECT>QWZmaWxpYXRlIHJlZ2lzdHJhdGlvbiBkZW5pZWQ=</SUBJECT>
<HTMLBODY>TmV3IEFmZmlsaWF0ZSByZWdpc3RyYXRpb24gaGFzIGJlZW4gZGVuaWVkLg==</HTMLBODY>
</EVENT>
<EVENT Event="AFFILIATE.REGISTRATION.DENIED" Type="1">
<SUBJECT>QWZmaWxpYXRlIHJlZ2lzdHJhdGlvbiBkZW5pZWQ=</SUBJECT>
<HTMLBODY>TmV3IEFmZmlsaWF0ZSByZWdpc3RyYXRpb24gaGFzIGJlZW4gZGVuaWVkLg==</HTMLBODY>
</EVENT>
<EVENT Event="BACKORDER.ADD" Type="0">
<SUBJECT>TmV3IEJhY2tvcmRlciBhZGRlZA==</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjpvcmRfRmllbGQgbmFtZT0iQmlsbGluZ1RvIi8+LDxici8+PGJyLz4NCg0KWW91ciBiYWNrIG9yZGVyIG51bWJlciA8aW5wMjpvcmRfRmllbGQgbmFtZT0iT3JkZXJOdW1iZXIiLz4gaGFzIGJlZW4gYWNjZXB0ZWQuIDxici8+PGJyLz4NCg0KWW91IHdpbGwgYmUgbm90aWZpZWQgYnkgZW1haWwgb25jZSB0aGUgb3JkZXIgaXMgcHJvY2Vzc2VkLg==</HTMLBODY>
</EVENT>
<EVENT Event="BACKORDER.ADD" Type="1">
<SUBJECT>TmV3IEJhY2tvcmRlciBhZGRlZA==</SUBJECT>
<HTMLBODY>TmV3IGJhY2sgb3JkZXIgbnVtYmVyIDxpbnAyOm9yZF9GaWVsZCBuYW1lPSJPcmRlck51bWJlciIvPiBoYXMgYmVlbiBhZGRlZC4gPGJyLz48YnIvPg0KDQpQbGVhc2UgcHJvY2VlZCB0byBhZG1pbmlzdHJhdGl2ZSBjb25zb2xlIHRvIHJldmlldyB0aGUgb3JkZXIu</HTMLBODY>
</EVENT>
<EVENT Event="BACKORDER.FULLFILL" Type="1">
<SUBJECT>QmFja29yZGVyIGhhcyBiZWVuIFByb2Nlc3NlZA==</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjpvcmQuLWludl9GaWVsZCBuYW1lPSJCaWxsaW5nVG8iLz4sPGJyLz48YnIvPg0KDQpZb3VyIGJhY2sgb3JkZXIgbnVtYmVyIDxpbnAyOm9yZC4taW52X0ZpZWxkIG5hbWU9Ik9yZGVyTnVtYmVyIi8+IGhhcyBiZWVuIHByb2Nlc3NlZCBhbmQgZnVsZmlsbGVkLg==</HTMLBODY>
</EVENT>
<EVENT Event="BACKORDER.PROCESS" Type="0">
<SUBJECT>WW91IEJhY2tvcmRlciAjPGlucDI6b3JkLi1pbnZfRmllbGQgbmFtZT0iT3JkZXJOdW1iZXIiLz4gLSBQcm9jZXNzZWQh</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjpvcmQuLWludl9GaWVsZCBuYW1lPSJCaWxsaW5nVG8iLz4sPGJyLz48YnIvPg0KDQpZb3VyIGJhY2sgb3JkZXIgKG51bWJlciA8aW5wMjpvcmQuLWludl9GaWVsZCBuYW1lPSJPcmRlck51bWJlciIvPikgaGFzIGJlZW4gcHJvY2Vzc2VkLg==</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.APPROVE" Type="0">
<SUBJECT>WW91ciBPcmRlciBpcyBBcHByb3ZlZA==</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjpvcmQuLWludl9GaWVsZCBuYW1lPSJCaWxsaW5nVG8iLz4sPGJyLz48YnIvPg0KDQpZb3VyIG9yZGVyIG51bWJlciA8aW5wMjpvcmQuLWludl9GaWVsZCBuYW1lPSJPcmRlck51bWJlciIvPiBoYXMgYmVlbiBhcHByb3ZlZC48YnIvPjxici8+DQoNCjxpbnAyOm1faWYgY2hlY2s9Im1fZ2V0IiB2YXI9Im9yZGVyX2NvdXBvbnMiPg0KWW91IGNhbiB1c2UgY291cG9uczo8YnIvPjxici8+DQo8aW5wMjptX2dldCB2YXI9Im9yZGVyX2NvdXBvbnMiLz4NCjwvaW5wMjptX2lmPg==</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.DENY" Type="0">
<SUBJECT>WW91ciBPcmRlciBpcyBEZW5pZWQ=</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjpvcmQuLWludl9GaWVsZCBuYW1lPSJCaWxsaW5nVG8iLz4sPGJyLz48YnIvPg0KDQpTb3JyeSwgYnV0IHlvdXIgb3JkZXIgKG51bWJlciA8aW5wMjpvcmQuLWludl9GaWVsZCBuYW1lPSJPcmRlck51bWJlciIvPikgaGFzIGJlZW4gZGVuaWVkLjxici8+PGJyLz4NCg0KUGxlYXNlIGZlZWwgZnJlZSB0byBjb250YWN0IHVzIGFyZSA8YSBocmVmPSIiPjwvYT4=</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.RECURRING.DENIED" Type="0">
<SUBJECT>UmVjdXJyaW5nIE9yZGVyIGlzIERlbmllZA==</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjpvcmQucmVjdXJyaW5nX0ZpZWxkIG5hbWU9IkJpbGxpbmdUbyIvPiw8YnIvPjxici8+DQoNClNvcnJ5LCBidXQgeW91ciByZWN1cnJpbmcgb3JkZXIgKG51bWJlciA8aW5wMjpvcmQucmVjdXJyaW5nX0ZpZWxkIG5hbWU9Ik9yZGVyTnVtYmVyIi8+KSBoYXMgYmVlbiBkZW5pZWQuPGJyLz48YnIvPg0KDQpQbGVhc2UgY29udGFjdCB3ZWJzaXRlIGFkbWluaXN0cmF0b3IgYXQgPGEgaHJlZj0ibWFpbHRvOjxpbnAyOm1fR2V0Q29uZmlnIHZhcj0iU210cF9BZG1pbk1haWxGcm9tIi8+PjxpbnAyOm1fR2V0Q29uZmlnIHZhcj0iU210cF9BZG1pbk1haWxGcm9tIi8+PC9hPg==</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.RECURRING.DENIED" Type="1">
<SUBJECT>UmVjdXJyaW5nIE9yZGVyICM8aW5wMjpvcmQucmVjdXJyaW5nX0ZpZWxkIG5hbWU9Ik9yZGVyTnVtYmVyIi8+IGlzIERlbmllZCBieSB0aGUgc3lzdGVt</SUBJECT>
<HTMLBODY>UmVjdXJyaW5nIG9yZGVyIG51bWJlciA8aW5wMjpvcmQucmVjdXJyaW5nX0ZpZWxkIG5hbWU9Ik9yZGVyTnVtYmVyIi8+IGhhcyBiZWVuIGRlbmllZC48YnIvPjxici8+DQoNClBsZWFzZSBwcm9jZWVkIHRvIGFkbWluaXN0cmF0aXZlIGNvbnNvbGUgdG8gcmV2aWV3IHRoZSBvcmRlci4=</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.RECURRING.PROCESSED" Type="0">
<SUBJECT>UmVjdXJyaW5nIE9yZGVyIFN1Y2Nlc3NmdWxseSBQcm9jZXNzZWQ=</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjpvcmQucmVjdXJyaW5nX0ZpZWxkIG5hbWU9IkJpbGxpbmdUbyIvPiw8YnIvPjxici8+DQoNCllvdXIgcmVjdXJyaW5nIG9yZGVyIChudW1iZXIgPGlucDI6b3JkLnJlY3VycmluZ19GaWVsZCBuYW1lPSJPcmRlck51bWJlciIvPikgaGFzIGJlZW4gc3VjY2Vzc2Z1bGx5IHByb2Nlc3NlZC48YnIvPjxici8+DQoNCk5vIGZ1cnRoZXIgYWN0aW9uIGlzIHJlcXVpcmVkIGF0IHRoaXMgdGltZS48YnIvPjxici8+</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.RECURRING.PROCESSED" Type="1">
<SUBJECT>UmVjdXJyaW5nIE9yZGVyICgjPGlucDI6b3JkLnJlY3VycmluZ19GaWVsZCBuYW1lPSJPcmRlck51bWJlciIvPikgaXMgUHJvY2Vzc2Vk</SUBJECT>
<HTMLBODY>UmVjdXJyaW5nIG9yZGVyIG51bWJlciA8aW5wMjpvcmQucmVjdXJyaW5nX0ZpZWxkIG5hbWU9Ik9yZGVyTnVtYmVyIi8+IGhhcyBiZWVuIHN1Y2Nlc3NmdWxseSBwcm9jZXNzZWQuPGJyLz48YnIvPg0KDQpObyBmdXJ0aGVyIGFjdGlvbiBpcyByZXF1aXJlZCBhdCB0aGlzIHRpbWUuDQo=</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.SHIP" Type="0">
<SUBJECT>WW91ciBPcmRlciB3YXMgc2hpcHBlZA==</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjpvcmQuLWludl9GaWVsZCBuYW1lPSJTaGlwcGluZ1RvIi8+LDxici8+PGJyLz4NCg0KWW91ciBvcmRlciAobnVtYmVyIDxpbnAyOm9yZC4taW52X0ZpZWxkIG5hbWU9Ik9yZGVyTnVtYmVyIi8+KSBoYXMgYmVlbiBzaGlwcGVkLg==</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.SUBMIT" Type="0">
<SUBJECT>VGhhbmsgeW91IGZvciBZb3VyIE9yZGVyICg8aW5wMjpvcmRfRmllbGQgbmFtZT0iT3JkZXJOdW1iZXIiIC8+KSE=</SUBJECT>
<HTMLBODY>PGlucDI6bV9EZWZpbmVFbGVtZW50IG5hbWU9Im9yZGVyaXRlbV9lbGVtIj4NCgk8aW5wMjpGaWVsZCBuYW1lPSJQcm9kdWN0TmFtZSIgcGFkPSIzNCIvPiAocXR5IDxpbnAyOkZpZWxkIG5hbWU9IlF1YW50aXR5Ii8+KSA8aW5wMjpGaWVsZCBuYW1lPSJFeHRlbmRlZFByaWNlIiBjdXJyZW5jeT0ic2VsZWN0ZWQiLz48YnIvPg0KPC9pbnAyOm1fRGVmaW5lRWxlbWVudD4NCg0KDQpEZWFyIDxpbnAyOm9yZF9GaWVsZCBuYW1lPSJCaWxsaW5nVG8iIC8+LDxici8+PGJyLz4NCg0KVGhhbmsgeW91IGZvciB5b3VyIHB1cmNoYXNlITxici8+PGJyLz4NCg0KPGlucDI6bV9pZiBjaGVjaz0ib3JkX1VzaW5nQ3JlZGl0Q2FyZCI+DQpQbGVhc2UgYWxsb3cgMjQgaG91cnMgZm9yIHVzIHRvIGNvbmZpcm0gYW5kIHByb2Nlc3MgeW91ciBvcmRlci4NCjxpbnAyOm1fZWxzZSAvPg0KUGxlYXNlIHNlbmQgYSBjaGVjayBvciBhIG1vbmV5IG9yZGVyIGluIHRoZSBhbW91bnQgb2YgPGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJUb3RhbEFtb3VudCIgY3VycmVuY3k9InNlbGVjdGVkIi8+IHRvOg0KPGJyLz4NCkFkZHJlc3MNCjxici8+DQpBbGwgY2hlY2tzIG11c3QgYmUgZHJhd24gaW4gVS5TLiBmdW5kcyBmcm9tIGEgVS5TLiBiYW5rLg0KUGxlYXNlIGF0dGFjaCBhIHByaW50b3V0IG9mIHRoaXMgcmVjZWlwdCB3aXRoIHlvdXIgY2hlY2sgYW5kDQp3cml0ZSBkb3duIHlvdXIgb3JkZXIgbnVtYmVyLiAgWW91ciBvcmRlciB3aWxsIGJlIGFwcHJvdmVkDQp3aXRoaW4gOCBidXNpbmVzcyBkYXlzIGFmdGVyIHRoZSBkYXkgd2UgcmVjZWl2ZSB5b3VyIGNoZWNrLA0Kb3Igd2l0aGluIDIgYnVzaW5lc3MgZGF5cyBhZnRlciB3ZSByZWNlaXZlIGEgbW9uZXkgb3JkZXIgb3INCmJhbmsgZHJhZnQuDQo8L2lucDI6bV9pZj4NCjxici8+PGJyLz48YnIvPg0KDQoNCkJlbG93IGFyZSB0aGUgZGV0YWlscyBvZiB5b3VyIG9yZGVyOjxici8+PGJyLz4NCg0KT3JkZXIgQ29udGVudHM6DQo8aHIvPg0KPGlucDI6b3JkX1ByaW50Q2FydCBpdGVtX3JlbmRlcl9hcz0ib3JkZXJpdGVtX2VsZW0iIGhlYWRlcl9yZW5kZXJfYXM9Imh0bWw6IiBmb290ZXJfcmVuZGVyX2FzPSJodG1sOiIgZW1wdHlfY2FydF9yZW5kZXJfYXM9Imh0bWw6IiBwZXJfcGFnZT0iLTEiLz4gDQo8aHIvPg0KU3ViIFRvdGFsOiAgIDxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iU3VidG90YWxXaXRoRGlzY291bnQiIGN1cnJlbmN5PSJzZWxlY3RlZCIvPjxici8+DQpUYXhlczogICAgICAgPGlucDI6b3JkX0ZpZWxkIG5hbWU9IlZBVCIgY3VycmVuY3k9InNlbGVjdGVkIi8+PGJyLz4NClRvdGFsOiAgICAgICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IlRvdGFsQW1vdW50IiBjdXJyZW5jeT0ic2VsZWN0ZWQiLz4gPGJyLz48YnIvPg0KDQpCaWxsaW5nIEluZm9ybWF0aW9uOg0KPGhyLz4NCkFtb3VudCBCaWxsZWQ6ICAgIDxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iVG90YWxBbW91bnQiIGN1cnJlbmN5PSJzZWxlY3RlZCIvPg0KPGlucDI6bV9pZiBjaGVjaz0ib3JkX1VzaW5nQ3JlZGl0Q2FyZCI+DQpQYXltZW50IFR5cGU6ICAgICA8aW5wMjpvcmRfRmllbGQgbmFtZT0iUGF5bWVudFR5cGUiIC8+DQpDcmVkaXQgQ2FyZDogICAgICA8aW5wMjpvcmRfRmllbGQgbmFtZT0iUGF5bWVudEFjY291bnQiIG1hc2tlZD0ibWFza2VkIi8+DQo8aW5wMjptX2Vsc2UgLz4NClBheW1lbnQgVHlwZTogICAgIDxpbnAyOm9yZF9GaWVsZCBuYW1lPSJQYXltZW50VHlwZSIgLz4NCjwvaW5wMjptX2lmPjxicj48YnIvPg0KDQpDb250YWN0IEluZm9ybWF0aW9uOg0KPGhyLz4NCk5hbWU6ICAgICAgICAgICAgIDxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iQmlsbGluZ1RvIi8+PGJyLz4NCkUtbWFpbDoJCQk8aW5wMjptX2lmIGNoZWNrPSJvcmRfRmllbGQiIG5hbWU9IkJpbGxpbmdFbWFpbCI+DQogIDxhIGhyZWY9Im1haWx0bzo8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdFbWFpbCIvPiI+PGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJCaWxsaW5nRW1haWwiLz48L2E+DQo8aW5wMjptX2Vsc2UgLz4NCiAgPGEgaHJlZj0ibWFpbHRvOjxpbnAyOnVfRmllbGQgZmllbGQ9IkVtYWlsIi8+Ij48aW5wMjp1X0ZpZWxkIGZpZWxkPSJFbWFpbCIvPjwvYT4NCjwvaW5wMjptX2lmPjxici8+DQpDb21wYW55L09yZ2FuaXphdGlvbjogICAgPGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJCaWxsaW5nQ29tcGFueSIvPjxici8+DQpQaG9uZTogICAgICAgICAgICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdQaG9uZSIvPjxici8+DQpGYXg6ICAgICAgICAgICAgICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdGYXgiLz48YnIvPg0KQWRkcmVzcyBMaW5lIDE6ICAgPGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJCaWxsaW5nQWRkcmVzczEiLz48YnIvPg0KQWRkcmVzcyBMaW5lIDI6ICAgPGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJCaWxsaW5nQWRkcmVzczIiLz48YnIvPg0KQ2l0eTogICAgICAgICAgICAgPGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJCaWxsaW5nQ2l0eSIvPjxici8+DQpTdGF0ZTogICAgICAgICAgICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdTdGF0ZSIvPiA8YnIvPg0KWklQIENvZGU6ICAgICAgICAgPGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJCaWxsaW5nWmlwIi8+PGJyLz4NCkNvdW50cnk6ICAgICAgICAgIDxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iQmlsbGluZ0NvdW50cnkiLz48YnIvPg0K</HTMLBODY>
</EVENT>
<EVENT Event="ORDER.SUBMIT" Type="1">
<SUBJECT>TmV3IE9yZGVyIFN1Ym1pdHRlZCAoPGlucDI6b3JkX0ZpZWxkIG5hbWU9Ik9yZGVyTnVtYmVyIi8+KQ==</SUBJECT>
<HTMLBODY>PGlucDI6bV9EZWZpbmVFbGVtZW50IG5hbWU9Im9yZGVyaXRlbV9lbGVtIj4NCjxpbnAyOkZpZWxkIG5hbWU9IlByb2R1Y3ROYW1lIiBwYWQ9IjM0Ii8+IChxdHkgPGlucDI6RmllbGQgbmFtZT0iUXVhbnRpdHkiLz4pIDxpbnAyOkZpZWxkIG5hbWU9IkV4dGVuZGVkUHJpY2UiIGN1cnJlbmN5PSJzZWxlY3RlZCIvPjxici8+DQo8L2lucDI6bV9EZWZpbmVFbGVtZW50Pg0KDQoNCkEgbmV3IG9yZGVyIGhhcyBiZWVuIHBsYWNlZC4gQmVsb3cgaXMgdGhlIHJlY2VpcHQgdGhhdCBoYXMgYmVlbiBzZW50IHRvIHRoZSBjdXN0b21lci48YnIvPg0KUGxlYXNlIHByb2NlZWQgdG8gYWRtaW5pc3RyYXRpb24gc2VjdGlvbiB0byBhcHByb3ZlIHRoaXMgb3JkZXIuPGJyLz48YnIvPg0KDQpPcmRlciBOdW1iZXI6IDxpbnAyOm9yZF9GaWVsZCBuYW1lPSJPcmRlck51bWJlciIgLz48YnIvPg0KRGF0ZS9UaW1lOiA8aW5wMjpvcmRfRmllbGQgbmFtZT0iT3JkZXJEYXRlIiAvPjxici8+PGJyLz48YnIvPg0KDQpEZWFyIDxpbnAyOm9yZF9GaWVsZCBuYW1lPSJCaWxsaW5nVG8iIC8+LDxici8+PGJyLz4NCg0KVGhhbmsgeW91IGZvciB5b3VyIHB1cmNoYXNlITxici8+PGJyLz4NCg0KPGlucDI6bV9pZiBjaGVjaz0ib3JkX1VzaW5nQ3JlZGl0Q2FyZCI+DQpQbGVhc2UgYWxsb3cgMjQgaG91cnMgZm9yIHVzIHRvIGNvbmZpcm0gYW5kIHByb2Nlc3MgeW91ciBvcmRlci4NCjxpbnAyOm1fZWxzZSAvPg0KUGxlYXNlIHNlbmQgYSBjaGVjayBvciBhIG1vbmV5IG9yZGVyIGluIHRoZSBhbW91bnQgb2YgPGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJUb3RhbEFtb3VudCIgY3VycmVuY3k9InNlbGVjdGVkIi8+IHRvOg0KPGJyPg0KQWRkcmVzcw0KPGJyPg0KQWxsIGNoZWNrcyBtdXN0IGJlIGRyYXduIGluIFUuUy4gZnVuZHMgZnJvbSBhIFUuUy4gYmFuay4NClBsZWFzZSBhdHRhY2ggYSBwcmludG91dCBvZiB0aGlzIHJlY2VpcHQgd2l0aCB5b3VyIGNoZWNrIGFuZA0Kd3JpdGUgZG93biB5b3VyIG9yZGVyIG51bWJlci4gIFlvdXIgb3JkZXIgd2lsbCBiZSBhcHByb3ZlZA0Kd2l0aGluIDggYnVzaW5lc3MgZGF5cyBhZnRlciB0aGUgZGF5IHdlIHJlY2VpdmUgeW91ciBjaGVjaywNCm9yIHdpdGhpbiAyIGJ1c2luZXNzIGRheXMgYWZ0ZXIgd2UgcmVjZWl2ZSBhIG1vbmV5IG9yZGVyIG9yDQpiYW5rIGRyYWZ0Lg0KPC9pbnAyOm1faWY+DQoNCg0KQmVsb3cgYXJlIHRoZSBkZXRhaWxzIG9mIHlvdXIgb3JkZXI6PGJyLz48YnIvPg0KDQpPcmRlciBDb250ZW50czo8YnIvPg0KPGhyLz4NCjxpbnAyOm9yZF9QcmludENhcnQgaXRlbV9yZW5kZXJfYXM9Im9yZGVyaXRlbV9lbGVtIiBoZWFkZXJfcmVuZGVyX2FzPSJodG1sOiIgZm9vdGVyX3JlbmRlcl9hcz0iaHRtbDoiIGVtcHR5X2NhcnRfcmVuZGVyX2FzPSJodG1sOiIgcGVyX3BhZ2U9Ii0xIi8+IA0KPGhyLz4NClN1YiBUb3RhbDogICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IlN1YnRvdGFsV2l0aERpc2NvdW50IiBjdXJyZW5jeT0ic2VsZWN0ZWQiLz48YnIvPg0KVGF4ZXM6ICAgICAgIDxpbnAyOm9yZF9GaWVsZCBuYW1lPSJWQVQiIGN1cnJlbmN5PSJzZWxlY3RlZCIvPjxici8+DQpUb3RhbDogICAgICAgPGlucDI6b3JkX0ZpZWxkIGZpZWxkPSJUb3RhbEFtb3VudCIgY3VycmVuY3k9InNlbGVjdGVkIi8+PGJyLz4NCg0KQmlsbGluZyBJbmZvcm1hdGlvbjoNCjxoci8+DQpBbW91bnQgQmlsbGVkOgk8aW5wMjpvcmRfRmllbGQgZmllbGQ9IlRvdGFsQW1vdW50IiBjdXJyZW5jeT0ic2VsZWN0ZWQiLz48YnIvPg0KPGlucDI6bV9pZiBjaGVjaz0ib3JkX1VzaW5nQ3JlZGl0Q2FyZCI+DQpQYXltZW50IFR5cGU6CTxpbnAyOm9yZF9GaWVsZCBuYW1lPSJQYXltZW50VHlwZSIgLz48YnIvPg0KQ3JlZGl0IENhcmQ6CTxpbnAyOm9yZF9GaWVsZCBuYW1lPSJQYXltZW50QWNjb3VudCIgbWFza2VkPSJtYXNrZWQiLz4NCjxpbnAyOm1fZWxzZSAvPg0KUGF5bWVudCBUeXBlOgk8aW5wMjpvcmRfRmllbGQgbmFtZT0iUGF5bWVudFR5cGUiIC8+DQo8L2lucDI6bV9pZj48YnIvPjxici8+DQoNCkNvbnRhY3QgSW5mb3JtYXRpb246PGJyLz4NCjxoci8+DQpOYW1lOiA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdUbyIvPjxici8+IA0KRS1tYWlsOgkJCTxpbnAyOm1faWYgY2hlY2s9Im9yZF9GaWVsZCIgbmFtZT0iQmlsbGluZ0VtYWlsIj4NCiAgPGEgaHJlZj0ibWFpbHRvOjxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iQmlsbGluZ0VtYWlsIi8+Ij48aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdFbWFpbCIvPjwvYT4NCjxpbnAyOm1fZWxzZSAvPg0KICA8YSBocmVmPSJtYWlsdG86PGlucDI6dV9GaWVsZCBmaWVsZD0iRW1haWwiLz4iPjxpbnAyOnVfRmllbGQgZmllbGQ9IkVtYWlsIi8+PC9hPg0KPC9pbnAyOm1faWY+PGJyLz4NCkNvbXBhbnkvT3JnYW5pemF0aW9uOiA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdDb21wYW55Ii8+PGJyLz4NClBob25lOiAgICAgICAgICAgIDxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iQmlsbGluZ1Bob25lIi8+PGJyLz4NCkZheDogICAgICAgICAgICAgIDxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iQmlsbGluZ0ZheCIvPjxici8+DQpBZGRyZXNzIExpbmUgMTogICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdBZGRyZXNzMSIvPjxici8+DQpBZGRyZXNzIExpbmUgMjogICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdBZGRyZXNzMiIvPjxici8+DQpDaXR5OiAgICAgICAgICAgICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdDaXR5Ii8+PGJyLz4NClN0YXRlOiAgICAgICAgICAgIDxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iQmlsbGluZ1N0YXRlIi8+PGJyLz4NClpJUCBDb2RlOiAgICAgICAgIDxpbnAyOm9yZF9GaWVsZCBmaWVsZD0iQmlsbGluZ1ppcCIvPjxici8+DQpDb3VudHJ5OiAgICAgICAgICA8aW5wMjpvcmRfRmllbGQgZmllbGQ9IkJpbGxpbmdDb3VudHJ5Ii8+PGJyLz4=</HTMLBODY>
</EVENT>
<EVENT Event="PRODUCT.SUGGEST" Type="0">
<SUBJECT>WW91ciBGcmllbmQgcmVjb21tZW5kcyB0byBsb29rIGF0IHRoaXMgaXRlbQ==</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjptX3BhcmFtIG5hbWU9InRvX25hbWUiIC8+LDxici8+PGJyLz4NCg0KPGlucDI6bV9wYXJhbSBuYW1lPSJmcm9tX25hbWUiIC8+IHRoaW5rcyB0aGF0IHRoaXMgaXRlbSBpbiBvdXIgb25saW5lIHN0b3JlIG1pZ2h0IGJlIG9mIGludGVyZXN0IHRvIHlvdS4gPGlucDI6bV9wYXJhbSBuYW1lPSJmcm9tX25hbWUiIC8+IHdyaXRlczo8YnI+DQotLS0tPGJyPg0KPGJsb2NrcXVvdGU+DQo8aW5wMjptX3BhcmFtIG5hbWU9Im1lc3NhZ2VfdGV4dCIvPg0KPC9ibG9ja3F1b3RlPg0KLS0tLTxicj4NCjxicj4NClRvIHNlZSB0aGUgaXRlbSBkZXRhaWxzLCBwbGVhc2UgPGEgaHJlZj0iPGlucDI6cF9Qcm9kdWN0TGluayB0ZW1wbGF0ZT0iaW4tY29tbWVyY2UvcHJvZHVjdC9kZXRhaWxzIi8+Ij5jbGljayBoZXJlPC9hPi48YnI+DQo8YnI+DQpTaW5jZXJlbHksPGJyPg0KPGlucDI6Y29uZl9Db25maWdWYWx1ZSBuYW1lPSJTaXRlX05hbWUiLz4gb25saW5lIHN0b3JlIEFkbWluaXN0cmF0aW9uPGJyPg0KPGJyPg0KPHNwYW4gc3R5bGU9ImZvbnQtc2l6ZTogc21hbGw7IGNvbG9yOiAjNTU1Ij4NClRoaXMgZW1haWwgd2FzIGdlbmVyYXRlZCBiZWNhdXNlIHNvbWVvbmUgd2hvIGtub3dzIHlvdXIgZW1haWwgYWRkcmVzcyBoYXMgY2hvc2VuIHRvIG5vdGlmeSB5b3UgYWJvdXQgb25lIG9mIG91ciBwcm9kdWN0cy4gVGhpcyBpcyBhbiBhdXRvbWF0aWMgZmVhdHVyZSBvZiBvdXIgb25saW5lIHN0b3JlLiBZb3VyIGVtYWlsIGFkZHJlc3MgaGFzIG5vdCBiZWVuIHJlY29yZGVkLCBhbmQgeW91IGhhdmUgbm90IGJlZW4gc3Vic2NyaWJlZCB0byBhbnkgbWFpbGluZyBsaXN0cy4gV2UgYXBvbG9naXplIGZvciBhbnkgaW5jb252ZW5pZW5jZSB0aGlzIG1lc3NhZ2UgbWlnaHQgaGF2ZSBjYXVzZWQuDQo8L3NtYWxsPg==</HTMLBODY>
</EVENT>
<EVENT Event="PRODUCT.SUGGEST" Type="1">
<SUBJECT>T25lIG9mIHlvdXIgUHJvZHVjdHMgaGFzIGJlZW4gUmVjb21tZW5kZWQ=</SUBJECT>
<HTMLBODY>QSBwcm9kdWN0IGZyb20gaGFzIGJlZW4gc3VnZ2VzdGVkLjxici8+PGJyLz4NCg0KU3VnZ2VzdGVkIHByb2R1Y3QgZGV0YWlsczogPGEgaHJlZj0iPGlucDI6cF9Qcm9kdWN0TGluayB0ZW1wbGF0ZT0iX19kZWZhdWx0X18iLz4iPjxpbnAyOnBfRmllbGQgbmFtZT0iTmFtZSIvPjwvYT48YnI+DQo=</HTMLBODY>
</EVENT>
<EVENT Event="USER.GIFTCERTIFICATE" Type="0">
<SUBJECT>WW91ciBHaWZ0IENlcnRpZmljYXRl</SUBJECT>
<HTMLBODY>RGVhciA8aW5wMjptX3BhcmFtIG5hbWU9InRvX25hbWUiLz4sPGJyLz48YnIvPg0KDQpQbGVhc2UgYWNjZXB0IHRoaXMgZ2lmdCBjZXJ0aWZpY2F0ZSBmb3IgdGhlIGFtb3VudCBvZiA8aW5wMjptX3BhcmFtIG5hbWU9ImFtb3VudCIvPiAuPGJyLz48YnIvPg0KDQpDZXJ0aWZpY2F0ZSBjb2RlIGlzOiA8aW5wMjptX3BhcmFtIG5hbWU9ImdpZmNlcnRfaWQiLz4gYW5kIGNhbiBiZSB1c2VkIGZvciBhbnkgcHVyY2hhc2Ugb24gb3VyIHdlYnNpdGUuPGJyLz48YnIvPg0KDQo8aW5wMjptX2lmIGNoZWNrPSJtX3BhcmFtIiBuYW1lPSJtZXNzYWdlIj4NCjxpbnAyOm1fcGFyYW0gbmFtZT0ibWVzc2FnZSIvPjxici8+DQo8L2lucDI6bV9pZj4NCjxici8+DQoNClRoYW5rIHlvdSBmb3Igc2hvcHBpbmcgd2l0aCB1cyENCg0KDQoNCg0K</HTMLBODY>
</EVENT>
<EVENT Event="USER.GIFTCERTIFICATE" Type="1">
<SUBJECT>R2lmdCBDZXJ0aWZpY2F0ZSAtIEVtYWlsIENvbmZpcm1hdGlvbg==</SUBJECT>
<HTMLBODY>VGhpcyBpcyBhbiBlbWFpbCBjb25maXJtYXRpb24gdGhhdCBHaWZ0IENlcnRpZmljYXRlICI8aW5wMjptX3BhcmFtIG5hbWU9ImdpZmNlcnRfaWQiLz4iIGhhcyBiZWVuIHN1Y2Nlc3NmdWxseSBlbWFpbGVkIHRvIDxpbnAyOm1fcGFyYW0gbmFtZT0idG9fbmFtZSIvPiAoPGEgaHJlZj0ibWFpbHRvOjxpbnAyOm1fcGFyYW0gbmFtZT0idG9fZW1haWwiLz4iPjxpbnAyOm1fcGFyYW0gbmFtZT0idG9fZW1haWwiLz48L2E+KSAu</HTMLBODY>
</EVENT>
</EVENTS>
</LANGUAGE>
</LANGUAGES>
\ No newline at end of file
Index: branches/5.3.x/install/install_data.sql
===================================================================
--- branches/5.3.x/install/install_data.sql (revision 15898)
+++ branches/5.3.x/install/install_data.sql (revision 15899)
@@ -1,480 +1,480 @@
# Section "in-commerce:contacts":
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_CompanyName', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ContactsGeneral', 'la_text_CompanyName', 'text', NULL, NULL, 10.01, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_StoreName', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ContactsGeneral', 'la_text_StoreName', 'text', NULL, NULL, 10.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Contacts_Name', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ContactsGeneral', 'la_text_ContactName', 'text', NULL, NULL, 10.03, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Contacts_Phone', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ContactsGeneral', 'la_text_Phone', 'text', NULL, NULL, 10.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Contacts_Fax', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ContactsGeneral', 'la_text_Fax', 'text', NULL, NULL, 10.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Contacts_Email', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ContactsGeneral', 'la_text_Email', 'text', NULL, NULL, 10.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Contacts_Additional', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ContactsGeneral', 'la_text_Additional', 'textarea', NULL, NULL, 10.07, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_AddressLine1', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_AddressLine1', 'text', NULL, NULL, 20.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_AddressLine2', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_AddressLine2', 'text', NULL, NULL, 20.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_City', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_City', 'text', NULL, NULL, 20.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_ZIP', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_ZIP', 'text', NULL, NULL, 20.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_Country', 'select', NULL, '0=lu_none||<SQL+>SELECT l%3$s_Name AS OptionName, IsoCode AS OptionValue FROM <PREFIX>CountryStates WHERE Type = 1 ORDER BY OptionName</SQL>', 20.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_State', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_State', 'text', NULL, '', 20.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Shipping_AddressLine1', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_AddressLine1', 'text', NULL, NULL, 30.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Shipping_AddressLine2', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_AddressLine2', 'text', NULL, NULL, 30.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Shipping_City', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_City', 'text', NULL, NULL, 30.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Shipping_ZIP', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_ZIP', 'text', NULL, NULL, 30.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Shipping_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_Country', 'select', NULL, '0=lu_none||<SQL+>SELECT l%3$s_Name AS OptionName, IsoCode AS OptionValue FROM <PREFIX>CountryStates WHERE Type = 1 ORDER BY OptionName</SQL>', 30.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Shipping_State', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_State', 'text', NULL, NULL, 30.06, 0, 1, NULL);
# Section "in-commerce:general":
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_RequireLoginBeforeCheckout', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_orders_RequireLogin', 'checkbox', NULL, NULL, 10.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Enable_Backordering', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_EnableBackordering', 'checkbox', NULL, NULL, 10.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Process_Backorders_Auto', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_ProcessBackorderingAuto', 'checkbox', NULL, NULL, 10.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Next_Order_Number', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_orders_NextOrderNumber', 'text', NULL, NULL, 10.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Order_Number_Format_P', '6', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_OrderMainNumberDigits', 'text', NULL, NULL, 10.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Order_Number_Format_S', '3', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_OrderSecNumberDigits', 'text', NULL, NULL, 10.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_RecurringChargeInverval', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_RecurringChargeInverval', 'text', NULL, NULL, 10.07, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_AutoProcessRecurringOrders', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_AutoProcessRecurringOrders', 'checkbox', NULL, NULL, 10.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxAddresses', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_MaxAddresses', 'text', NULL, NULL, 10.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_MaskProcessedCreditCards', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_MaskProcessedCreditCards', 'checkbox', NULL, NULL, 10.1, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'OrderVATIncluded', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_config_OrderVATIncluded', 'checkbox', NULL, NULL, 10.11, '0', '0', NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_ExchangeRateSource', '3', 'In-Commerce', 'in-commerce:general', 'la_Text_Currencies', 'la_ExchangeRateSource', 'select', NULL, '2=la_FederalReserveBank||3=la_EuropeanCentralBank||1=la_BankOfLatvia', 20.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_DefaultCouponDuration', '14', 'In-Commerce', 'in-commerce:general', 'la_Text_Coupons', 'la_conf_DefaultCouponDuration', 'text', NULL, NULL, 30.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_RegisterAsAffiliate', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Affiliates', 'la_prompt_register_as_affiliate', 'checkbox', NULL, '', 40.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_AffiliateStorageMethod', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Affiliates', 'la_prompt_affiliate_storage_method', 'radio', NULL, '1=la_opt_Session||2=la_opt_PermanentCookie', 40.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_AffiliateCookieDuration', '30', 'In-Commerce', 'in-commerce:general', 'la_Text_Affiliates', 'la_prompt_affiliate_cookie_duration', 'text', NULL, '', 40.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_PriceBracketCalculation', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_PricingCalculation', 'la_prompt_PriceBracketCalculation', 'radio', NULL, '1=la_opt_PriceCalculationByPrimary||2=la_opt_PriceCalculationByOptimal', 50, 0, 1, NULL);
# Section "in-commerce:output":
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_OrderProductsBy', 'Name', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_OrderProductsBy', 'select', NULL, '=la_none||Name=la_fld_Title||SKU=la_fld_SKU||Manufacturer=la_fld_Manufacturer||Price=la_fld_Price||CreatedOn=la_fld_CreatedOn||Modified=la_fld_Modified||Qty=la_fld_Qty||<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomFields WHERE (Type = 11) AND (IsSystem = 0)</SQL>', 10.01, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_OrderProductsByDir', 'ASC', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_OrderProductsBy', 'select', NULL, 'ASC=la_common_Ascending||DESC=la_common_Descending', 10.01, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_OrderProductsThenBy', 'Price', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_ThenBy', 'select', NULL, '=la_none||Name=la_fld_Title||SKU=la_fld_SKU||Manufacturer=la_fld_Manufacturer||Price=la_fld_Price||CreatedOn=la_fld_CreatedOn||Modified=la_fld_Modified||Qty=la_fld_Qty||<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomFields WHERE (Type = 11) AND (IsSystem = 0)</SQL>', 10.02, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_OrderProductsThenByDir', 'ASC', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_ThenBy', 'select', NULL, 'ASC=la_common_Ascending||DESC=la_common_Descending', 10.02, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Perpage_Products', '10', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_Perpage_Products', 'text', NULL, NULL, 10.03, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Perpage_Products_Short', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_Perpage_Products_Shortlist', 'text', NULL, NULL, 10.04, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Product_NewDays', '7', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_DaysToBeNew', 'text', NULL, NULL, 10.05, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Product_MinPopRating', '4', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_fld_Product_MinPopRating', 'text', NULL, NULL, 10.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Product_MinPopVotes', '1', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_fld_Product_MinPopVotes', 'text', NULL, NULL, 10.07, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Product_MaxHotNumber', '5', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_fld_Product_MaxHotNumber', 'text', NULL, NULL, 10.08, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'products_EditorPicksAboveRegular', '1', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_EditorPicksAboveRegular', 'checkbox', NULL, NULL, 10.09, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_RatingDelay_Value', '30', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_prompt_DupRating', 'text', '', 'style="width: 50px;"', 10.1, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_RatingDelay_Interval', '86400', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_prompt_DupRating', 'select', '', '1=la_opt_Sec||60=la_opt_Min||3600=la_opt_Hour||86400=la_opt_Day||604800=la_opt_Week||2419200=la_opt_Month||29030400=la_opt_Year', 10.1, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ShowProductImagesInOrders', '0', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_config_ShowProductImagesInOrders', 'checkbox', NULL, NULL, 10.11, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxCompareProducts', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_config_MaxCompareProducts', 'text', NULL, NULL, 10.12, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Perpage_Reviews', '10', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_config_PerpageReviews', 'text', NULL, NULL, 20.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_ReviewDelay_Value', '30', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_prompt_DupReviews', 'text', '', 'style="width: 50px;"', 20.02, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_ReviewDelay_Interval', '86400', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_prompt_DupReviews', 'select', '', '1=la_opt_Sec||60=la_opt_Min||3600=la_opt_Hour||86400=la_opt_Day||604800=la_opt_Week||2419200=la_opt_Month||29030400=la_opt_Year', 20.02, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Perpage_Manufacturers', '10', 'In-Commerce', 'in-commerce:output', 'la_Text_Manufacturers', 'la_Perpage_Manufacturers', 'text', NULL, NULL, 30.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Perpage_Manufacturers_Short', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Manufacturers', 'la_Perpage_Manufacturers_Short', 'text', NULL, NULL, 30.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'p_CategoryTemplate', '/in-commerce/designs/section', 'In-Commerce', 'in-commerce:output', 'la_section_Templates', 'la_fld_CategoryTemplate', 'text', '', '', 40.01, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'p_ItemTemplate', 'in-commerce/products/product_detail', 'In-Commerce', 'in-commerce:output', 'la_section_Templates', 'la_fld_ItemTemplate', 'text', '', '', 40.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'p_MaxImageCount', '5', 'In-Commerce', 'in-commerce:output', 'la_section_ImageSettings', 'la_config_MaxImageCount', 'text', '', '', 50.01, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'p_ThumbnailImageWidth', '120', 'In-Commerce', 'in-commerce:output', 'la_section_ImageSettings', 'la_config_ThumbnailImageWidth', 'text', '', '', 50.02, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'p_ThumbnailImageHeight', '120', 'In-Commerce', 'in-commerce:output', 'la_section_ImageSettings', 'la_config_ThumbnailImageHeight', 'text', '', '', 50.03, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'p_FullImageWidth', '450', 'In-Commerce', 'in-commerce:output', 'la_section_ImageSettings', 'la_config_FullImageWidth', 'text', '', '', 50.04, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'p_FullImageHeight', '450', 'In-Commerce', 'in-commerce:output', 'la_section_ImageSettings', 'la_config_FullImageHeight', 'text', '', '', 50.05, 0, 0, NULL);
# Section "in-commerce:search":
INSERT INTO SystemSettings VALUES(DEFAULT, 'Search_ShowMultiple_products', '1', 'In-Commerce', 'in-commerce:search', 'la_config_ShowMultiple', 'la_Text_MultipleShow', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Keyword_products', '70', 'In-Commerce', 'in-commerce:search', 'la_config_SearchRel_DefaultKeyword', 'la_text_keyword', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Pop_products', '10', 'In-Commerce', 'in-commerce:search', 'la_config_DefaultPop', 'la_text_popularity', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Rating_products', '10', 'In-Commerce', 'in-commerce:search', 'la_config_DefaultRating', 'la_prompt_Rating', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SearchRel_Increase_products', '30', 'In-Commerce', 'in-commerce:search', 'la_config_DefaultIncreaseImportance', 'la_text_increase_importance', 'text', NULL, NULL, 0, 0, 1, NULL);
INSERT INTO Currencies VALUES (6, 'AFA', '', 0, 'la_AFA', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (7, 'ALL', '', 0, 'la_ALL', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (8, 'DZD', '', 0, 'la_DZD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (9, 'ADP', '', 0, 'la_ADP', 1, 1124019233, 0, 0, 0);
INSERT INTO Currencies VALUES (10, 'AOA', '', 0, 'la_AOA', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (11, 'ARS', '', 0, 'la_ARS', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (12, 'AMD', '', 0, 'la_AMD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (13, 'AWG', '', 0, 'la_AWG', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (14, 'AZM', '', 0, 'la_AZM', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (15, 'BSD', '', 0, 'la_BSD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (16, 'BHD', '', 0, 'la_BHD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (17, 'BDT', '', 0, 'la_BDT', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (18, 'BBD', '', 0, 'la_BBD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (19, 'BYR', '', 0, 'la_BYR', 0.46440677966102, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (20, 'BZD', '', 0, 'la_BZD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (21, 'BMD', '', 0, 'la_BMD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (22, 'BTN', '', 0, 'la_BTN', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (23, 'INR', '', 0, 'la_INR', 0.022962112514351, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (24, 'BOV', '', 0, 'la_BOV', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (25, 'BOB', '', 0, 'la_BOB', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (26, 'BAM', '', 0, 'la_BAM', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (27, 'BWP', '', 0, 'la_BWP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (28, 'BRL', '', 0, 'la_BRL', 0.42331625957753, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (29, 'BND', '', 0, 'la_BND', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (30, 'BGL', '', 0, 'la_BGL', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (31, 'BGN', '', 0, 'la_BGN', 0.60754639807761, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (32, 'BIF', '', 0, 'la_BIF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (33, 'KHR', '', 0, 'la_KHR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (34, 'CAD', '', 0, 'la_CAD', 0.80579100834068, 1120657409, 0, 0, 0);
INSERT INTO Currencies VALUES (35, 'CVE', '', 0, 'la_CVE', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (36, 'KYD', '', 0, 'la_KYD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (37, 'XAF', '', 0, 'la_XAF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (38, 'CLF', '', 0, 'la_CLF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (39, 'CLP', '', 0, 'la_CLP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (40, 'CNY', '', 0, 'la_CNY', 0.12082358922217, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (41, 'COP', '', 0, 'la_COP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (42, 'KMF', '', 0, 'la_KMF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (43, 'CDF', '', 0, 'la_CDF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (44, 'CRC', '', 0, 'la_CRC', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (45, 'HRK', '', 0, 'la_HRK', 0.16222968545216, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (46, 'CUP', '', 0, 'la_CUP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (47, 'CYP', '', 0, 'la_CYP', 2.0723753051971, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (48, 'CZK', '', 0, 'la_CZK', 0.039512535745162, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (49, 'DKK', '', 0, 'la_DKK', 0.15944343065693, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (50, 'DJF', '', 0, 'la_DJF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (51, 'DOP', '', 0, 'la_DOP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (52, 'TPE', '', 0, 'la_TPE', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (53, 'ECV', '', 0, 'la_ECV', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (54, 'ECS', '', 0, 'la_ECS', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (55, 'EGP', '', 0, 'la_EGP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (56, 'SVC', '', 0, 'la_SVC', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (57, 'ERN', '', 0, 'la_ERN', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (58, 'EEK', '', 0, 'la_EEK', 0.075946211956591, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (59, 'ETB', '', 0, 'la_ETB', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (60, 'FKP', '', 0, 'la_FKP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (61, 'FJD', '', 0, 'la_FJD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (62, 'GMD', '', 0, 'la_GMD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (63, 'GEL', '', 0, 'la_GEL', 1, 1124019233, 0, 0, 0);
INSERT INTO Currencies VALUES (64, 'GHC', '', 0, 'la_GHC', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (65, 'GIP', '', 0, 'la_GIP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (66, 'GTQ', '', 0, 'la_GTQ', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (67, 'GNF', '', 0, 'la_GNF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (68, 'GWP', '', 0, 'la_GWP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (69, 'GYD', '', 0, 'la_GYD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (70, 'HTG', '', 0, 'la_HTG', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (71, 'HNL', '', 0, 'la_HNL', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (72, 'HKD', '', 0, 'la_HKD', 0.1286359158665, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (73, 'HUF', '', 0, 'la_HUF', 0.0048070388349515, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (74, 'ISK', '', 0, 'la_ISK', 0.015143366891806, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (75, 'IDR', '', 0, 'la_IDR', 0.00010126584435926, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (76, 'IRR', '', 0, 'la_IRR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (77, 'IQD', '', 0, 'la_IQD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (78, 'ILS', '', 0, 'la_ILS', 0.21864406779661, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (79, 'JMD', '', 0, 'la_JMD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (80, 'JPY', '', 0, 'la_JPY', 0.0089325716003909, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (81, 'JOD', '', 0, 'la_JOD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (82, 'KZT', '', 0, 'la_KZT', 7.3559322033898, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (83, 'KES', '', 0, 'la_KES', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (84, 'AUD', '', 0, 'la_AUD', 0.74088160109733, 1120650640, 1, 0, 0);
INSERT INTO Currencies VALUES (85, 'KPW', '', 0, 'la_KPW', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (86, 'KRW', '', 0, 'la_KRW', 0.00095066281590758, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (87, 'KWD', '', 0, 'la_KWD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (88, 'KGS', '', 0, 'la_KGS', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (89, 'LAK', '', 0, 'la_LAK', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (90, 'LVL', '', 0, 'la_LVL', 1.7697169946847, 1124019016, 0, 0, 0);
INSERT INTO Currencies VALUES (91, 'LBP', '', 0, 'la_LBP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (92, 'LSL', '', 0, 'la_LSL', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (93, 'LRD', '', 0, 'la_LRD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (94, 'LYD', '', 0, 'la_LYD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (95, 'CHF', '', 0, 'la_CHF', 0.76560788608981, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (96, 'LTL', '', 0, 'la_LTL', 0.34415546802595, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (97, 'MOP', '', 0, 'la_MOP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (98, 'MKD', '', 0, 'la_MKD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (99, 'MGF', '', 0, 'la_MGF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (100, 'MWK', '', 0, 'la_MWK', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (101, 'MYR', '', 0, 'la_MYR', 0.2631019594819, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (102, 'MVR', '', 0, 'la_MVR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (103, 'MTL', '', 0, 'la_MTL', 2.7679944095038, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (104, 'EUR', '&euro;&nbsp;', 0, 'la_EUR', 1.2319, 1124019016, 1, 0, 0);
INSERT INTO Currencies VALUES (105, 'MRO', '', 0, 'la_MRO', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (106, 'MUR', '', 0, 'la_MUR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (107, 'MXN', '', 0, 'la_MXN', 0.092980009298001, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (108, 'MXV', '', 0, 'la_MXV', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (109, 'MDL', '', 0, 'la_MDL', 0.079830508474576, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (110, 'MNT', '', 0, 'la_MNT', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (111, 'XCD', '', 0, 'la_XCD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (112, 'MZM', '', 0, 'la_MZM', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (113, 'MMK', '', 0, 'la_MMK', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (114, 'ZAR', '', 0, 'la_ZAR', 0.14487399875645, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (115, 'NAD', '', 0, 'la_NAD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (116, 'NPR', '', 0, 'la_NPR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (117, 'ANG', '', 0, 'la_ANG', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (118, 'XPF', '', 0, 'la_XPF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (120, 'NIO', '', 0, 'la_NIO', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (121, 'NGN', '', 0, 'la_NGN', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (122, 'NOK', '', 0, 'la_NOK', 0.15015163002274, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (123, 'OMR', '', 0, 'la_OMR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (124, 'PKR', '', 0, 'la_PKR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (125, 'PAB', '', 0, 'la_PAB', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (126, 'PGK', '', 0, 'la_PGK', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (127, 'PYG', '', 0, 'la_PYG', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (128, 'PEN', '', 0, 'la_PEN', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (129, 'PHP', '', 0, 'la_PHP', 0.017769769111138, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (130, 'PLN', '', 0, 'la_PLN', 0.29408270844161, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (131, 'USD', '$&nbsp;', 0, 'la_USD', 1, 1124019100, 1, 1, 0);
INSERT INTO Currencies VALUES (132, 'QAR', '', 0, 'la_QAR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (133, 'ROL', '', 0, 'la_ROL', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (134, 'RUB', NULL, 0, 'la_RUB', 0.0347, 1123850285, 0, 0, 0);
INSERT INTO Currencies VALUES (136, 'RWF', '', 0, 'la_RWF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (137, 'SHP', '', 0, 'la_SHP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (138, 'WST', '', 0, 'la_WST', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (139, 'STD', '', 0, 'la_STD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (140, 'SAR', '', 0, 'la_SAR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (141, 'SCR', '', 0, 'la_SCR', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (142, 'SLL', '', 0, 'la_SLL', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (143, 'SGD', '', 0, 'la_SGD', 0.58838383838384, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (144, 'SKK', '', 0, 'la_SKK', 0.031050431147113, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (145, 'SIT', '', 0, 'la_SIT', 0.0049628299365185, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (146, 'SBD', '', 0, 'la_SBD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (147, 'SOS', '', 0, 'la_SOS', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (148, 'LKR', '', 0, 'la_LKR', 0.0099920063948841, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (149, 'SDD', '', 0, 'la_SDD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (150, 'SRG', '', 0, 'la_SRG', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (151, 'SZL', '', 0, 'la_SZL', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (152, 'SEK', '', 0, 'la_SEK', 0.12594327624216, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (153, 'SYP', '', 0, 'la_SYP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (154, 'TWD', '', 0, 'la_TWD', 0.031298904538341, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (155, 'TJS', '', 0, 'la_TJS', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (156, 'TZS', '', 0, 'la_TZS', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (157, 'THB', '', 0, 'la_THB', 0.024061474911918, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (158, 'XOF', '', 0, 'la_XOF', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (159, 'NZD', '', 0, 'la_NZD', 0.67409802586794, 1120650640, 0, 0, 0);
INSERT INTO Currencies VALUES (160, 'TOP', '', 0, 'la_TOP', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (161, 'TTD', '', 0, 'la_TTD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (162, 'TND', '', 0, 'la_TND', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (163, 'TRL', '', 0, 'la_TRL', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (164, 'TMM', '', 0, 'la_TMM', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (165, 'UGX', '', 0, 'la_UGX', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (166, 'UAH', '', 0, 'la_UAH', 0.19830508474576, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (167, 'AED', '', 0, 'la_AED', 0.2728813559322, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (168, 'GBP', NULL, 0, 'la_GBP', 1.7543367535248, 1120657409, 1, 0, 0);
INSERT INTO Currencies VALUES (169, 'USS', '', 0, 'la_USS', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (170, 'USN', '', 0, 'la_USN', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (171, 'UYU', '', 0, 'la_UYU', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (172, 'UZS', '', 0, 'la_UZS', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (173, 'VUV', '', 0, 'la_VUV', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (174, 'VEB', '', 0, 'la_VEB', 0.00046628741956542, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (175, 'VND', '', 0, 'la_VND', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (176, 'MAD', '', 0, 'la_MAD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (177, 'YER', '', 0, 'la_YER', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (178, 'YUM', '', 0, 'la_YUM', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (179, 'ZMK', '', 0, 'la_ZMK', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (180, 'ZWD', '', 0, 'la_ZWD', 1, 1120641028, 0, 0, 0);
INSERT INTO Currencies VALUES (181, 'AFN', '', 0, 'la_AFN', 0.02, 1120641028, 0, 0, 0);
INSERT INTO CustomFields VALUES (DEFAULT, 11, 'Features', 'la_Features', 1, 'la_Text_CustomFields', 'la_Features', 'textarea', 'rows="5" cols="70"', '', 0, 1, 0, 0);
INSERT INTO CustomFields VALUES (DEFAULT, 11, 'Availability', 'la_Availability', 1, 'la_Text_CustomFields', 'la_Availability', 'text', 'size="70"', '', 0, 1, 0, 0);
INSERT INTO CustomFields VALUES (DEFAULT, 1, 'p_ItemTemplate', 'la_fld_cust_p_ItemTemplate', 0, 'la_title_SystemCF', 'la_fld_cust_p_ItemTemplate', 'text', NULL, '', 0, 0, 1, 0);
INSERT INTO CustomFields VALUES (DEFAULT, 6, 'shipping_addr_block', 'la_fld_BlockShippingAddress', 0, 'la_section_StoreSettings', 'la_fld_BlockShippingAddress', 'checkbox', '1=+Block', '', 0, 1, 1, 0);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.SUBMIT', NULL, 1, 1, 'In-Commerce', 'Order Submitted', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.SUBMIT', NULL, 1, 1, 'In-Commerce', 'Order Submitted', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.APPROVE', NULL, 1, 0, 'In-Commerce', 'Order Approved', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.DENY', NULL, 1, 0, 'In-Commerce', 'Order Denied', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.SHIP', NULL, 1, 0, 'In-Commerce', 'Order Shipped', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'BACKORDER.ADD', NULL, 1, 1, 'In-Commerce', 'Backorder Added', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'BACKORDER.ADD', NULL, 1, 1, 'In-Commerce', 'Backorder Added', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'BACKORDER.FULLFILL', NULL, 1, 0, 'In-Commerce', 'Back-order is Fulfilled', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'BACKORDER.PROCESS', NULL, 1, 0, 'In-Commerce', 'Backorder Processed', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'PRODUCT.SUGGEST', NULL, 1, 0, 'In-Commerce', 'Suggest product to a friend', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'PRODUCT.SUGGEST', NULL, 1, 1, 'In-Commerce', 'Suggest product to a friend', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.REGISTER', NULL, 1, 1, 'In-Commerce', 'Affiliate registered', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.REGISTER', NULL, 1, 1, 'In-Commerce', 'Affiliate registered', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.PAYMENT', NULL, 1, 0, 'In-Commerce', 'Affiliate payment issued', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.PAYMENT', NULL, 1, 0, 'In-Commerce', 'Affiliate payment issued', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.REGISTRATION.APPROVED', NULL, 1, 0, 'In-Commerce', 'Affiliate registration approved', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.REGISTRATION.APPROVED', NULL, 0, 0, 'In-Commerce', 'Affiliate registration approved', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.REGISTRATION.DENIED', NULL, 1, 0, 'In-Commerce', 'Affiliate registration denied', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.REGISTRATION.DENIED', NULL, 0, 0, 'In-Commerce', 'Affiliate registration denied', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.PAYMENT.TYPE.CHANGED', NULL, 1, 0, 'In-Commerce', 'Affiliate payment type changed', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'AFFILIATE.PAYMENT.TYPE.CHANGED', NULL, 1, 0, 'In-Commerce', 'Affiliate payment type changed', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.RECURRING.PROCESSED', NULL, 1, 0, 'In-Commerce', 'Recurring Order Processed', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.RECURRING.PROCESSED', NULL, 1, 0, 'In-Commerce', 'Recurring Order Processed', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.RECURRING.DENIED', NULL, 1, 0, 'In-Commerce', 'Recurring Order Denied', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ORDER.RECURRING.DENIED', NULL, 1, 0, 'In-Commerce', 'Recurring Order Denied', 1, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.GIFTCERTIFICATE', NULL, 1, 0, 'In-Commerce', 'Gift Certificate', 0, 1, 1);
INSERT INTO EmailTemplates (TemplateId, TemplateName, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.GIFTCERTIFICATE', NULL, 1, 0, 'In-Commerce', 'Gift Certificate', 1, 1, 1);
INSERT INTO GatewayConfigFields VALUES (1, 'submit_url', 'Gateway URL', 'text', '', 2);
INSERT INTO GatewayConfigFields VALUES (2, 'user_account', 'Authorize.net User Name', 'text', '', 2);
INSERT INTO GatewayConfigFields VALUES (4, 'transaction_key', 'Authorize.net Transaction Key', 'text', '', 2);
INSERT INTO GatewayConfigFields VALUES (9, 'business_account', 'Username', 'text', '', 4);
INSERT INTO GatewayConfigFields VALUES (10, 'submit_url', 'Gateway URL', 'text', '', 4);
INSERT INTO GatewayConfigFields VALUES (11, 'currency_code', 'Payment Currency Code', 'text', '', 4);
INSERT INTO GatewayConfigFields VALUES (12, 'shipping_control', 'Shipping Control', 'select', '3=la_CreditDirect,4=la_CreditPreAuthorize', 2);
INSERT INTO GatewayConfigFields VALUES (13, 'encapsulate_char', 'Encapsulate Char', 'text', '', 2);
INSERT INTO GatewayConfigFields VALUES (14, 'shipping_control', 'Shipping Control', 'select', '3=la_CreditDirect,4=la_CreditPreAuthorize', 4);
INSERT INTO GatewayConfigValues VALUES (36, 12, 3, '4');
INSERT INTO GatewayConfigValues VALUES (35, 1, 3, 'https://secure.authorize.net/gateway/transact.dll');
INSERT INTO GatewayConfigValues VALUES (34, 2, 3, '');
INSERT INTO GatewayConfigValues VALUES (33, 4, 3, '');
INSERT INTO GatewayConfigValues VALUES (32, 9, 4, '');
INSERT INTO GatewayConfigValues VALUES (31, 10, 4, 'https://www.paypal.com/cgi-bin/webscr');
INSERT INTO GatewayConfigValues VALUES (37, 11, 4, 'USD');
INSERT INTO GatewayConfigValues VALUES (38, 13, 3, '|');
INSERT INTO GatewayConfigValues VALUES (39, 14, 4, '4');
INSERT INTO Gateways VALUES (1, 'None', 'kGWBase', 'gw_base.php', 0);
INSERT INTO Gateways VALUES (2, 'Credit Card (Authorize.Net)', 'kGWAuthorizeNet', 'authorizenet.php', 1);
INSERT INTO Gateways VALUES (3, 'Credit Card (Manual Processing)', 'kGWBase', 'gw_base.php', 1);
INSERT INTO Gateways VALUES (4, 'PayPal', 'kGWPayPal', 'paypal.php', 0);
INSERT INTO ItemTypes VALUES (11, 'In-Commerce', 'p', 'Products', 'Name', 'CreatedById', NULL, NULL, '', 0, '', 'ProductsItem', 'Product');
INSERT INTO ItemTypes VALUES (13, 'In-Commerce', 'ord', 'Orders', 'OrderNumber', '', NULL, NULL, '', 0, '', 'OrdersItem', 'Order');
INSERT INTO PaymentTypes (PaymentTypeId, `Name`, l1_Description, l1_Instructions, AdminComments, `Status`, Priority, IsPrimary, BuiltIn, GatewayId, PlacedOrdersEdit, ProcessingFee, PortalGroups) VALUES (1, 'Credit Card (manual)', 'Credit Card', 'Please enter your credit card details.', NULL, 1, 0, 1, 1, 3, DEFAULT, DEFAULT, ',15,');
INSERT INTO PaymentTypes (PaymentTypeId, `Name`, l1_Description, l1_Instructions, AdminComments, `Status`, Priority, IsPrimary, BuiltIn, GatewayId, PlacedOrdersEdit, ProcessingFee, PortalGroups) VALUES (4, 'PayPal', 'PayPal', 'You will be redirected to PayPal site to make the payment after confirming your order on the next checkout step.', NULL, 0, 0, 0, 1, 4, DEFAULT, DEFAULT, ',15,');
INSERT INTO PaymentTypes (PaymentTypeId, `Name`, l1_Description, l1_Instructions, AdminComments, `Status`, Priority, IsPrimary, BuiltIn, GatewayId, PlacedOrdersEdit, ProcessingFee, PortalGroups) VALUES (2, 'Check/MO', 'Check or Money Order', NULL, NULL, 0, 0, 0, 1, 1, 1, DEFAULT, ',15,');
INSERT INTO PaymentTypes (PaymentTypeId, `Name`, l1_Description, l1_Instructions, AdminComments, `Status`, Priority, IsPrimary, BuiltIn, GatewayId, PlacedOrdersEdit, ProcessingFee, PortalGroups) VALUES (3, 'Authorize.Net', 'Credit Card', 'Please enter your Credit Card details below. Your credit card will not be charged until you confirm your purchase on the next(last) step of checkout process.', NULL, 0, 0, 0, 1, 2, DEFAULT, DEFAULT, ',15,');
INSERT INTO PaymentTypeCurrencies VALUES (DEFAULT, 4, 131);
INSERT INTO PaymentTypeCurrencies VALUES (DEFAULT, 2, 131);
INSERT INTO PaymentTypeCurrencies VALUES (DEFAULT, 3, 131);
INSERT INTO PaymentTypeCurrencies VALUES (DEFAULT, 1, 131);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'PRODUCT.RATE', 'la_PermName_Product.Rate_desc', 'In-Commerce', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'PRODUCT.REVIEW', 'la_PermName_Product.Review_desc', 'In-Commerce', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'PRODUCT.REVIEW.PENDING', 'la_PermName_Product.Review_Pending_desc', 'In-Commerce', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'PRODUCT.ADD', 'la_PermName_Product.Add_desc', 'In-Commerce', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'PRODUCT.DELETE', 'la_PermName_Product.Delete_desc', 'In-Commerce', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'PRODUCT.MODIFY', 'la_PermName_Product.Modify_desc', 'In-Commerce', 1);
INSERT INTO CategoryPermissionsConfig VALUES (DEFAULT, 'PRODUCT.VIEW', 'la_PermName_Product.View_desc', 'In-Commerce', 1);
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 14, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.RATE', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.REVIEW', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.REVIEW.PENDING', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'FAVORITES', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 13, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 12, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.ADD', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.DELETE', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.MODIFY', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'PRODUCT.VIEW', 11, 1, 0, {ProductCatId});
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:products.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:setting_folder.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:deny', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:archive', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:place', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:process', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:ship', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:orders.advanced:reset_to_pending', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:discounts.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:coupons.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:manufacturers.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:manufacturers.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:manufacturers.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:manufacturers.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.advanced:move_up', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.advanced:move_down', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.advanced:update_rate', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:currencies.advanced:set_primary', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping_quote_engines.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping_quote_engines.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping_quote_engines.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:shipping_quote_engines.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:payment_types.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:payment_types.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:payment_types.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:payment_types.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:taxes.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:taxes.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:taxes.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:taxes.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliates.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_plans.advanced:set_primary', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:set_primary', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:move_up', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:affiliate_payment_types.advanced:move_down', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:general.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:general.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:general.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:output.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:output.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:output.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:search.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:search.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:contacts.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:contacts.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:contacts.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:configuration_custom.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:configuration_custom.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:configuration_custom.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:configuration_custom.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:paymentlog.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:downloadlog.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:downloadlog.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.advanced:approve', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:gift-certificates.advanced:decline', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:reports.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-commerce:reports.add', 11, 1, 1, 0);
INSERT INTO SearchConfig VALUES ('Products', 'OrgId', 0, 0, 'lu_fielddesc_prod_orgid', 'lc_field_orgid', 'In-Commerce', 'la_Text_Products', 19, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'NewItem', 0, 1, 'lu_fielddesc_prod_newitem', 'lu_field_newproduct', 'In-Commerce', 'la_Text_Products', 18, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'PopItem', 0, 1, 'lu_fielddesc_prod_popitem', 'lu_field_popproduct', 'In-Commerce', 'la_Text_Products', 17, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'HotItem', 0, 1, 'lu_fielddesc_prod_topseller', 'lc_field_topseller', 'In-Commerce', 'la_Text_Products', 16, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'EditorsPick', 0, 1, 'lu_fielddesc_prod_editorspick', 'lc_field_EditorsPick', 'In-Commerce', 'la_Text_Products', 14, DEFAULT, 0, 'boolean', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'CachedReviewsQty', 0, 0, 'lu_fielddesc_prod_cachedreviewsqty', 'lc_field_cachedreviewsqty', 'In-Commerce', 'la_Text_Products', 9, DEFAULT, 0, 'range', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'CachedVotesQty', 0, 0, 'lu_fielddesc_prod_cachedvotesqty', 'lc_field_cachedvotesqty', 'In-Commerce', 'la_Text_Products', 8, DEFAULT, 0, 'range', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'ProductId', 0, 0, 'lu_fielddesc_prod_productid', 'lu_field_productid', 'In-Commerce', 'la_Text_Products', 0, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'Name', 1, 1, 'lu_fielddesc_prod_producttitle', 'lu_field_producttitle', 'In-Commerce', 'la_Text_Products', 1, DEFAULT, 3, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'Description', 1, 1, 'lu_fielddesc_prod_description', 'lc_field_description', 'In-Commerce', 'la_Text_Products', 2, DEFAULT, 1, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'CreatedOn', 0, 1, 'lu_fielddesc_prod_createdon', 'lc_field_createdon', 'In-Commerce', 'la_Text_Products', 4, DEFAULT, 0, 'date', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'Modified', 0, 1, 'lu_fielddesc_prod_modified', 'lc_field_modified', 'In-Commerce', 'la_Text_Products', 5, DEFAULT, 0, 'date', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'Hits', 0, 1, 'lu_fielddesc_prod_qtysold', 'lc_field_qtysold', 'In-Commerce', 'la_Text_Products', 6, DEFAULT, 0, 'range', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'CachedRating', 0, 0, 'lu_fielddesc_prod_cachedrating', 'lc_field_cachedrating', 'In-Commerce', 'la_Text_Products', 7, DEFAULT, 0, 'range', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('CustomFields', 'Features', 1, 0, 'la_Features', 'la_Features', 'In-Commerce', 'la_Text_CustomFields', 0, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'SKU', 1, 1, 'lu_fielddesc_prod_sku', 'lu_field_sku', 'In-Commerce', 'la_Text_Products', 0, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'DescriptionExcerpt', 1, 0, 'lu_fielddesc_prod_descriptionex', 'lc_field_descriptionex', 'In-Commerce', 'la_Text_Products', 2, DEFAULT, 1, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'ManufacturerId', 1, 1, 'lu_fielddesc_prod_manufacturer', 'lc_field_manufacturer', 'In-Commerce', 'la_Text_Products', 3, DEFAULT, 2, 'text', 'Manufacturers.Name', '{ForeignTable}.ManufacturerId={LocalTable}.ManufacturerId', NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('Products', 'Price', 1, 1, 'lu_fielddesc_prod_price', 'lu_field_price', 'In-Commerce', 'la_Text_Products', 23, DEFAULT, 2, 'range', 'CALC:MIN( IF({PREFIX}ProductsDiscounts.Type = 1, {PREFIX}ProductsPricing.Price - {PREFIX}ProductsDiscounts.Amount, IF({PREFIX}ProductsDiscounts.Type = 2, ({PREFIX}ProductsPricing.Price * (1-{PREFIX}ProductsDiscounts.Amount/100)), {PREFIX}ProductsPricing.Price ) ) )', '{PREFIX}ProductsPricing ON {PREFIX}ProductsPricing.ProductId = {PREFIX}Products.ProductId AND {PREFIX}ProductsPricing.IsPrimary = 1 LEFT JOIN {PREFIX}ProductsDiscountItems ON {PREFIX}ProductsDiscountItems.ItemResourceId = {PREFIX}Products.ResourceId LEFT JOIN {PREFIX}ProductsDiscounts ON {PREFIX}ProductsDiscounts.DiscountId = {PREFIX}ProductsDiscountItems.DiscountId AND {PREFIX}ProductsDiscounts.Status = 1 AND {PREFIX}ProductsDiscountItems.ItemType = 1 AND ( {PREFIX}ProductsDiscounts.GroupId IN ({USER_GROUPS},NULL) AND ( ({PREFIX}ProductsDiscounts.Start IS NULL OR {PREFIX}ProductsDiscounts.Start < UNIX_TIMESTAMP()) AND ({PREFIX}ProductsDiscounts.Start IS NULL OR {PREFIX}ProductsDiscounts.End > UNIX_TIMESTAMP()) ) )', NULL, NULL, NULL, NULL, NULL);
INSERT INTO SearchConfig VALUES ('CustomFields', 'Availability', 0, 0, 'la_Availability', 'la_Availability', 'In-Commerce', 'la_Text_CustomFields', 0, DEFAULT, 0, 'text', NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO ShippingQuoteEngines VALUES (1, 'Intershipper.com', 0, 0, 0, 'a:21:{s:12:"AccountLogin";N;s:15:"AccountPassword";s:0:"";s:10:"UPSEnabled";i:1;s:10:"UPSAccount";N;s:11:"UPSInvoiced";N;s:10:"FDXEnabled";i:1;s:10:"FDXAccount";N;s:10:"DHLEnabled";i:1;s:10:"DHLAccount";N;s:11:"DHLInvoiced";i:0;s:10:"USPEnabled";i:1;s:10:"USPAccount";N;s:11:"USPInvoiced";i:0;s:10:"ARBEnabled";i:1;s:10:"ARBAccount";N;s:11:"ARBInvoiced";N;s:10:"1DYEnabled";i:1;s:10:"2DYEnabled";i:1;s:10:"3DYEnabled";i:1;s:10:"GNDEnabled";i:1;s:10:"ShipMethod";s:3:"DRP";}', 'Intershipper');
INSERT INTO ShippingQuoteEngines VALUES ( DEFAULT, 'USPS.com', 0, 0, 0, 'a:21:{s:12:"AccountLogin";s:0:"";s:15:"AccountPassword";N;s:10:"UPSEnabled";N;s:10:"UPSAccount";s:0:"";s:11:"UPSInvoiced";N;s:10:"FDXEnabled";N;s:10:"FDXAccount";s:0:"";s:10:"DHLEnabled";N;s:10:"DHLAccount";s:0:"";s:11:"DHLInvoiced";N;s:10:"USPEnabled";N;s:10:"USPAccount";s:0:"";s:11:"USPInvoiced";N;s:10:"ARBEnabled";N;s:10:"ARBAccount";s:0:"";s:11:"ARBInvoiced";N;s:10:"1DYEnabled";N;s:10:"2DYEnabled";N;s:10:"3DYEnabled";N;s:10:"GNDEnabled";N;s:10:"ShipMethod";N;}', 'USPS' ) ;
DELETE FROM SystemCache WHERE VarName = 'config_files';
INSERT INTO ImportScripts VALUES (DEFAULT, 'Products from CSV file [In-Commerce]', '', 'p', 'In-Commerce', '', 'CSV', '1');
INSERT INTO ItemFilters VALUES
(DEFAULT, 'p', 'ManufacturerId', 'checkbox', 1, NULL),
(DEFAULT, 'p', 'Price', 'range', 1, 10),
(DEFAULT, 'p', 'EditorsPick', 'radio', 1, NULL);
-INSERT INTO Modules VALUES ('In-Commerce', 'modules/in-commerce/', 'p', DEFAULT, 1, 4, 'in-commerce/', 2, NULL, NULL);
+INSERT INTO Modules VALUES ('In-Commerce', 'modules/in-commerce/', 'Intechnic\\InPortal\\Modules\\InCommerce', 'p', DEFAULT, 1, 4, 'in-commerce/', 2, NULL, NULL);
Index: branches/5.3.x/install.php
===================================================================
--- branches/5.3.x/install.php (revision 15898)
+++ branches/5.3.x/install.php (revision 15899)
@@ -1,52 +1,58 @@
<?php
/**
* @version $Id$
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
- $module_folder = 'modules/in-commerce';
+$module_folder = 'modules/in-commerce';
- if (!defined('IS_INSTALL')) {
- // separate module install
- define('IS_INSTALL', 1);
- define('ADMIN', 1);
- define('FULL_PATH', realpath(dirname(__FILE__) . '/../..') );
+if ( !defined('IS_INSTALL') ) {
+ // separate module install
+ define('IS_INSTALL', 1);
+ define('ADMIN', 1);
+ define('FULL_PATH', realpath(dirname(__FILE__) . '/../..'));
- include_once(FULL_PATH . '/core/kernel/startup.php');
- require_once FULL_PATH . '/core/install/install_toolkit.php';
+ include_once(FULL_PATH . '/core/kernel/startup.php');
+ require_once FULL_PATH . '/core/install/install_toolkit.php';
- $toolkit = new kInstallToolkit();
- }
- else {
- // install, using installation wizard
- $toolkit =& $this->toolkit;
- /* @var $toolkit kInstallToolkit */
- }
-
- $application =& kApplication::Instance();
- $application->Init();
+ $constants_file = FULL_PATH . '/' . $module_folder . '/constants.php';
- if ($application->RecallVar('user_id') != USER_ROOT) {
- die('restricted access!');
+ if ( file_exists($constants_file) ) {
+ require_once $constants_file;
}
- $category =& $toolkit->createModuleCategory('Products', 'Product Catalog', '#in-commerce/section_design#', 'in-commerce/img/menu_products.gif');
-
- $toolkit->RunSQL('/' . $module_folder . '/install/install_schema.sql');
- $toolkit->RunSQL('/' . $module_folder . '/install/install_data.sql', '{ProductCatId}', $category->GetID());
- $toolkit->ImportLanguage('/' . $module_folder . '/install/english');
-
- $toolkit->SetModuleRootCategory(basename($module_folder), $category->GetID());
-
- $toolkit->linkCustomFields(basename($module_folder), 'p', 11); // to create Custom Fields for Products
- $toolkit->linkCustomFields('KERNEL', 'u', 6); // to create shipping related Custom Fields for Users
- $toolkit->linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field
- $toolkit->setModuleItemTemplate($category, 'p', '#in-commerce/item_design#');
+ $toolkit = new kInstallToolkit();
+}
+else {
+ // install, using installation wizard
+ $toolkit =& $this->toolkit;
+ /* @var $toolkit kInstallToolkit */
+}
+
+$application =& kApplication::Instance();
+$application->Init();
+
+if ( $application->RecallVar('user_id') != USER_ROOT ) {
+ die('restricted access!');
+}
+
+$category =& $toolkit->createModuleCategory('Products', 'Product Catalog', '#in-commerce/section_design#', 'in-commerce/img/menu_products.gif');
+
+$toolkit->RunSQL('/' . $module_folder . '/install/install_schema.sql');
+$toolkit->RunSQL('/' . $module_folder . '/install/install_data.sql', '{ProductCatId}', $category->GetID());
+$toolkit->ImportLanguage('/' . $module_folder . '/install/english');
+
+$toolkit->SetModuleRootCategory(basename($module_folder), $category->GetID());
+
+$toolkit->linkCustomFields(basename($module_folder), 'p', 11); // to create Custom Fields for Products
+$toolkit->linkCustomFields('KERNEL', 'u', 6); // to create shipping related Custom Fields for Users
+$toolkit->linkCustomFields('KERNEL', 'c', 1); // to create ItemTemplate custom field
+$toolkit->setModuleItemTemplate($category, 'p', '#in-commerce/item_design#');
- $toolkit->finalizeModuleInstall($module_folder, true);
\ No newline at end of file
+$toolkit->finalizeModuleInstall($module_folder, true);
Index: branches/5.3.x
===================================================================
--- branches/5.3.x (revision 15898)
+++ branches/5.3.x (revision 15899)
Property changes on: branches/5.3.x
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
Merged /w/in-commerce/branches/5.2.x:r15631-15898

Event Timeline