Go to the documentation of this file.
22 parent::__construct($oConfig,
$oDb);
24 $this->_sLangsPrefix = $this->_oConfig->getLangsPrefix();
28 parent::loadTemplates();
30 $this->_aTemplates[
'script'] =
'<script language="javascript" type="text/javascript">__content__</script>';
31 $this->_aTemplates[
'on_result'] =
'<script language="javascript" type="text/javascript">alert(\'__message__\')</script>';
32 $this->_aTemplates[
'on_result_inline'] =
'<script language="javascript" type="text/javascript">parent.__js_object__.showResultInline(__params__);</script>';
37 return PopupBox(
'pmt-orders-more',
_t($this->_sLangsPrefix .
'wcpt_order_info'),
$sContent);
42 foreach($aItemsInfo
as $aItem) {
45 'price' => $aItem[
'price'],
46 'ch_if:link' => array(
47 'condition' => !
empty($aItem[
'url']),
49 'url' => $aItem[
'url'],
50 'title' => $aItem[
'title']
53 'ch_if:text' => array(
54 'condition' =>
empty($aItem[
'url']),
56 'title' => $aItem[
'title']
62 return $this->
parseHtmlByName(
'items.html', array(
'ch_repeat:items' => $aItems));
68 'form' =>
$oForm->getCode(),
69 'loading' =>
LoadingBox(
'pmt-order-manual-loading')
72 return PopupBox(
'pmt-manual-order',
_t($this->_sLangsPrefix .
'wcpt_manual_order'),
$sContent);
76 $sMethodName =
'get' . ucfirst(
$sType);
77 $aOrder = $this->_oDb->$sMethodName(array(
'type' =>
'id',
'id' =>
$iId));
78 $aSeller = $this->_oDb->getVendorInfoProfile((
int)$aOrder[
'seller_id']);
81 'txt_client' =>
_t($this->_sLangsPrefix .
'txt_client'),
82 'txt_seller' =>
_t($this->_sLangsPrefix .
'txt_seller'),
83 'txt_order' =>
_t($this->_sLangsPrefix .
'txt_order'),
84 'txt_processed_with' =>
_t($this->_sLangsPrefix .
'txt_processed_with'),
85 'txt_message' =>
_t($this->_sLangsPrefix .
'txt_message'),
86 'txt_date' =>
_t($this->_sLangsPrefix .
'txt_date'),
87 'txt_products' =>
_t($this->_sLangsPrefix .
'txt_products'),
90 'ch_if:show_link' => array(
91 'condition' => !
empty($aSeller[
'profile_url']),
93 'seller_name' => $aSeller[
'profile_name'],
94 'seller_url' => $aSeller[
'profile_url'],
97 'ch_if:show_text' => array(
98 'condition' =>
empty($aSeller[
'profile_url']),
100 'seller_name' => $aSeller[
'profile_name']
103 'order' => $aOrder[
'order'],
104 'provider' => $aOrder[
'provider'],
105 'error' => $aOrder[
'error_msg'],
106 'date' => $aOrder[
'date_uf'],
107 'ch_repeat:items' => array()
113 $aItems =
ChPmtCart::items2array($aOrder[
'seller_id'] .
'_' . $aOrder[
'module_id'] .
'_' . $aOrder[
'item_id'] .
'_' . $aOrder[
'item_count']);
115 foreach($aItems
as $aItem) {
116 $aInfo =
ChWsbService::call((
int)$aItem[
'module_id'],
'get_cart_item', array($aOrder[
'client_id'], $aItem[
'item_id']));
118 $aResult[
'ch_repeat:items'][] = array(
119 'ch_if:link' => array(
122 'title' =>
$aInfo[
'title'],
126 'ch_if:text' => array(
129 'title' =>
$aInfo[
'title'],
132 'quantity' => $aItem[
'item_count'],
133 'price' =>
$aInfo[
'price'],
134 'currency_code' => $aSeller[
'currency_code']
142 if(
empty($aParams[
'per_page']))
143 $aParams[
'per_page'] = $this->_oConfig->getPerPage(
'orders');
144 $sJsObject = $this->_oConfig->getJsObject(
'orders');
146 $sMethodNameInfo =
'get' . ucfirst(
$sType) .
'Orders';
147 $aOrders = $this->_oDb->$sMethodNameInfo($aParams);
149 return MsgBox(
_t($this->_sLangsPrefix .
'msg_no_results'));
153 $sTxtMoreProducts =
_t($this->_sLangsPrefix .
'txt_more_products');
154 $sTxtMoreItems =
_t($this->_sLangsPrefix .
'txt_more_items');
155 $sTxtActionMore =
_t($this->_sLangsPrefix .
'txt_action_more');
158 $aResultOrders = array();
159 foreach($aOrders
as $aOrder) {
160 if(
empty($aOrder[
'user_id'])) {
161 $aOrder[
'user_name'] = $aAdministrator[
'profile_name'];
162 $aOrder[
'user_url'] = $aAdministrator[
'profile_url'];
165 $aOrder[
'user_name'] =
getNickName($aOrder[
'user_id']);
167 if(!$aOrder[
'user_name']) {
168 $aOrder[
'user_name'] =
_t(
'_undefined');
169 $aOrder[
'user_url'] =
'';
173 $aResultOrders[] = array_merge($aOrder, array(
174 'js_object' => $sJsObject,
176 'txt_more_products' => $sTxtMoreProducts,
177 'txt_more_items' => $sTxtMoreItems,
178 'txt_action_more' => $sTxtActionMore,
179 'ch_if:show_link' => array(
180 'condition' => !
empty($aOrder[
'user_url']),
182 'user_name' => $aOrder[
'user_name'],
183 'user_url' => $aOrder[
'user_url']
186 'ch_if:show_text' => array(
187 'condition' =>
empty($aOrder[
'user_url']),
189 'user_name' => $aOrder[
'user_name']
192 'ch_if:pending' => array(
195 'id' => $aOrder[
'id'],
196 'order' => $aOrder[
'order']
199 'ch_if:processed' => array(
202 'order' => $aOrder[
'order']
205 'products' => $aOrder[
'products'],
206 'items' => $aOrder[
'items'],
212 $sPaginatePanel =
"";
213 $sMethodNameCount =
'get' . ucfirst(
$sType) .
'OrdersCount';
214 if(($iCount = $this->_oDb->$sMethodNameCount($aParams)) > $aParams[
'per_page']) {
216 'start' => $aParams[
'start'],
218 'per_page' => $aParams[
'per_page'],
219 'per_page_step' => 2,
220 'per_page_interval' => 3,
222 'on_change_page' => $sJsObject .
".changePage('" .
$sType .
"', {start}, {per_page}, " . $aParams[
'seller_id'] .
")"
224 $sPaginatePanel = $oPaginate->getPaginate();
228 'ch_repeat:orders' => $aResultOrders,
229 'paginate_panel' => $sPaginatePanel
234 $sJsObject = $this->_oConfig->getJsObject(
'orders');
242 $aButtons[
'pmt-process'] =
_t($this->_sLangsPrefix .
'btn_process');
243 $aButtons[
'pmt-cancel'] =
_t($this->_sLangsPrefix .
'btn_cancel');
244 $aButtons[
'pmt-report'] =
_t($this->_sLangsPrefix .
'btn_report');
246 $aButtons[
'pmt-manual'] = array(
'type' =>
'button',
'name' =>
'pmt-manual',
'value' =>
_t($this->_sLangsPrefix .
'btn_manual_order'),
'onclick' =>
'onclick="javascript:' . $sJsObject .
'.addManually(this);"');
251 'txt_date' =>
_t($this->_sLangsPrefix .
'txt_date'),
252 'txt_client' =>
_t($this->_sLangsPrefix .
'txt_client'),
253 'txt_order' =>
_t($this->_sLangsPrefix .
'txt_order'),
254 'txt_amount' =>
_t($this->_sLangsPrefix .
'txt_amount'),
255 'txt_license' =>
_t($this->_sLangsPrefix .
'txt_license'),
256 'txt_action' =>
_t($this->_sLangsPrefix .
'txt_action'),
258 'action' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'act_orders_submit/' .
$sType,
259 'orders' => $this->displayOrders(
$sType, array(
'seller_id' => $iVendorId,
'start' => 0)),
260 'filter_panel' => $sFilterPanel,
261 'control_panel' => $sControlPanel,
267 $sJsObject = $this->_oConfig->getJsObject(
'orders');
273 'txt_date' =>
_t($this->_sLangsPrefix .
'txt_date'),
274 'txt_seller' =>
_t($this->_sLangsPrefix .
'txt_seller'),
275 'txt_order' =>
_t($this->_sLangsPrefix .
'txt_order'),
276 'txt_amount' =>
_t($this->_sLangsPrefix .
'txt_amount'),
277 'txt_license' =>
_t($this->_sLangsPrefix .
'txt_license'),
278 'txt_action' =>
_t($this->_sLangsPrefix .
'txt_action'),
279 'orders' => $this->
displayOrders(
'history', array(
'user_id' => $iUserId,
'seller_id' => $iVendorId,
'start' => 0)),
280 'filter_panel' => $sFilterPanel,
281 'loading' =>
LoadingBox(
'pmt-orders-history-loading')
287 foreach(
$aInfo as $iVendorId => $aVendorCart) {
290 foreach($aVendorCart[
'items']
as $aItem)
292 'vendor_id' => $aVendorCart[
'vendor_id'],
293 'vendor_currency_code' => $aVendorCart[
'vendor_currency_code'],
294 'item_id' => $aItem[
'id'],
295 'item_title' => $aItem[
'title'],
296 'item_url' => $aItem[
'url'],
297 'item_quantity' => $aItem[
'quantity'],
298 'item_price' => $aItem[
'quantity'] * $aItem[
'price'],
303 'vendor_id' => $aVendorCart[
'vendor_id'],
304 'ch_if:show_link' => array(
305 'condition' => !
empty($aVendorCart[
'vendor_profile_url']),
307 'vendor_username' => $aVendorCart[
'vendor_profile_name'],
308 'vendor_url' => $aVendorCart[
'vendor_profile_url'],
309 'vendor_currency_code' => $aVendorCart[
'vendor_currency_code'],
310 'items_count' => $aVendorCart[
'items_count'],
311 'items_price' => $aVendorCart[
'items_price']
314 'ch_if:show_text' => array(
315 'condition' =>
empty($aVendorCart[
'vendor_profile_url']),
317 'vendor_username' => $aVendorCart[
'vendor_profile_name'],
318 'vendor_currency_code' => $aVendorCart[
'vendor_currency_code'],
319 'items_count' => $aVendorCart[
'items_count'],
320 'items_price' => $aVendorCart[
'items_price']
323 'vendor_icon' => $aVendorCart[
'vendor_profile_icon'],
324 'ch_repeat:items' => $aItems
327 return $this->
addCss(
'toolbar.css',
true) . $this->
parseHtmlByName(
'toolbar_submenu.html', array(
'ch_repeat:carts' => $aCarts));
331 $iAdminId = $this->_oConfig->getAdminId();
332 $sJsObject = $this->_oConfig->getJsObject(
'cart');
335 $aCartInfo = array($aCartInfo);
338 foreach($aCartInfo
as $aVendor) {
340 $aProviders = array();
341 $aVendorProviders = $this->_oDb->getVendorInfoProviders($aVendor[
'vendor_id']);
342 foreach($aVendorProviders
as $aProvider)
343 $aProviders[] = array(
344 'name' => $aProvider[
'name'],
345 'caption' =>
_t($this->_sLangsPrefix .
'txt_cart_' . $aProvider[
'name']),
346 'checked' =>
empty($aProviders) ?
'checked="checked"' :
''
351 foreach($aVendor[
'items']
as $aItem)
353 'vendor_id' => $aVendor[
'vendor_id'],
354 'vendor_currency_code' => $aVendor[
'vendor_currency_code'],
355 'module_id' => $aItem[
'module_id'],
356 'item_id' => $aItem[
'id'],
357 'item_title' => $aItem[
'title'],
358 'item_url' => $aItem[
'url'],
359 'item_quantity' => $aItem[
'quantity'],
360 'ch_if:show_price_paid' => array(
361 'condition' => (
float)$aItem[
'price'] != 0,
363 'item_price' => $aItem[
'quantity'] * $aItem[
'price'],
364 'vendor_currency_code' => $aVendor[
'vendor_currency_code'],
367 'ch_if:show_price_free' => array(
368 'condition' => (
int)$aItem[
'price'] == 0,
371 'js_object' => $sJsObject
376 'pmt-checkout' =>
_t($this->_sLangsPrefix .
'btn_checkout'),
377 'pmt-delete' =>
_t($this->_sLangsPrefix .
'btn_delete')
383 'vendor_id' => $aVendor[
'vendor_id'],
384 'ch_if:show_link' => array(
385 'condition' => !
empty($aVendor[
'vendor_profile_url']),
387 'txt_shopping_cart' =>
_t($this->_sLangsPrefix .
'txt_shopping_cart', $this->
parseHtmlByName(
'vendor_link.html', array(
388 'vendor_username' => $aVendor[
'vendor_profile_name'],
389 'vendor_url' => $aVendor[
'vendor_profile_url'],
391 'txt_shopping_cart_summary' =>
_t(
'_payment_txt_shopping_cart_summary', $aVendor[
'items_count'], $aVendor[
'items_price'], $aVendor[
'vendor_currency_code']),
392 'vendor_currency_code' => $aVendor[
'vendor_currency_code'],
393 'items_count' => $aVendor[
'items_count'],
394 'items_price' => $aVendor[
'items_price']
397 'ch_if:show_text' => array(
398 'condition' =>
empty($aVendor[
'vendor_profile_url']),
400 'txt_shopping_cart' =>
_t($this->_sLangsPrefix .
'txt_shopping_cart', $aVendor[
'vendor_profile_name']),
401 'txt_shopping_cart_summary' =>
_t(
'_payment_txt_shopping_cart_summary', $aVendor[
'items_count'], $aVendor[
'items_price'], $aVendor[
'vendor_currency_code']),
402 'vendor_currency_code' => $aVendor[
'vendor_currency_code'],
403 'items_count' => $aVendor[
'items_count'],
404 'items_price' => $aVendor[
'items_price']
407 'vendor_icon' => $aVendor[
'vendor_profile_icon'],
408 'ch_repeat:providers' => $aProviders,
409 'ch_repeat:items' => $aItems,
410 'js_object' => $sJsObject,
411 'process_url' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'act_cart_submit/',
412 'control_panel' => $sControlPanel
416 $this->
addCss(
'cart.css');
417 $this->
addJs(
'cart.js');
422 $this->
addJs(
'cart.js');
425 return $aJs[
'js_content'];
427 function displayAddToCartJs($iVendorId, $iModuleId, $iItemId, $iItemCount, $bNeedRedirect =
false, $bWrapped =
true)
433 'js_object' => $aJs[
'js_object'],
434 'vendor_id' => $iVendorId,
435 'module_id' => $iModuleId,
436 'item_id' => $iItemId,
437 'item_count' => $iItemCount,
438 'need_redirect' => (
int)$bNeedRedirect
441 return array($sJsCode, $sJsMethod);
445 $this->
addJs(
'cart.js');
447 'txt_add_to_cart' =>
_t($this->_sLangsPrefix .
'txt_add_to_cart'),
448 'vendor_id' => $iVendorId,
449 'module_id' => $iModuleId,
450 'item_id' => $iItemId,
451 'item_count' => $iItemCount,
452 'need_redirect' => (
int)$bNeedRedirect
461 $iIndex = isset($aParams[
'index']) ? (int)$aParams[
'index'] : 0;
463 $_page[
'js_name'] = isset($aParams[
'js']) ? $aParams[
'js'] :
'';
464 $_page[
'css_name'] = isset($aParams[
'css']) ? $aParams[
'css'] :
'';
465 $_page[
'extra_js'] = isset($aParams[
'extra_js']) ? $aParams[
'extra_js'] :
'';
469 if(isset($aParams[
'content']))
470 foreach($aParams[
'content']
as $sKey => $sValue)
473 if(isset($aParams[
'title'][
'page']))
475 if(isset($aParams[
'title'][
'block']))
478 if(isset($aParams[
'breadcrumb']))
479 $GLOBALS[
'oTopMenu']->setCustomBreadcrumbs($aParams[
'breadcrumb']);
488 'page' =>
_t($this->_sLangsPrefix .
'pcpt_response')
501 'page' =>
_t($this->_sLangsPrefix .
'pcpt_error')
515 $iIndex = isset($aParams[
'index']) ? (int)$aParams[
'index'] : 9;
517 $_page[
'js_name'] = isset($aParams[
'js']) ? $aParams[
'js'] :
'';
518 $_page[
'css_name'] = isset($aParams[
'css']) ? $aParams[
'css'] :
'';
519 $_page[
'header'] = isset($aParams[
'title'][
'page']) ? $aParams[
'title'][
'page'] :
'';
521 if(isset($aParams[
'content']))
522 foreach($aParams[
'content']
as $sKey => $sValue)
530 $sJsClass = $this->_oConfig->getJsClass(
'cart');
531 $sJsObject = $this->_oConfig->getJsObject(
'cart');
534 'sActionUrl' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri(),
535 'sObjName' => $sJsObject,
536 'sAnimationEffect' => $this->_oConfig->getAnimationEffect(),
537 'iAnimationSpeed' => $this->_oConfig->getAnimationSpeed()
540 $sJsContent =
'var ' . $sJsObject .
' = new ' . $sJsClass .
'(' . json_encode($aOptions) .
');';
544 return array(
'js_object' => $sJsObject,
'js_content' => $sJsContent);
const CH_PMT_ADMINISTRATOR_ID
_getJsContentCart($bWrapped=true)
const CH_PMT_ORDERS_TYPE_PROCESSED
MsgBox($sText, $iTimer=0)
displayItems($aItemsInfo)
ch_import($sClassName, $aModule=array())
$_page_cont[$_ni]['page_main_code']
addCss($mixedFiles, $bDynamic=false)
__construct(&$oConfig, &$oDb)
getPageCodeAdmin(&$aParams)
displayCartContent($aCartInfo, $iVendorId=CH_PMT_EMPTY_ID)
const CH_PMT_ORDERS_TYPE_SUBSCRIPTION
static showAdminFilterPanel($sFilterValue, $sInputId='filter_input_id', $sCheckboxId='filter_checkbox_id', $sFilterName='filter', $sOnApply='')
getPageCodeError($sMessage, $bWrap=true)
displayHistoryBlock($iUserId, $iVendorId)
displayToolbarSubmenu($aInfo)
const CH_PMT_ORDERS_TYPE_PENDING
displayOrders($sType, $aParams)
const CH_PMT_ORDERS_TYPE_HISTORY
displayOrder($sType, $iId)
PageCodeAdmin($oTemplate=null)
_t($key, $arg0="", $arg1="", $arg2="")
PageCode($oTemplate=null)
getProfileLink( $iID, $sLinkAdd='')
addJs($mixedFiles, $bDynamic=false)
displayAddToCartLink($iVendorId, $iModuleId, $iItemId, $iItemCount, $bNeedRedirect=false)
displayCartJs($bWrapped=true)
PopupBox($sName, $sTitle, $sContent, $aActions=array())
static showAdminActionsPanel($sWrapperId, $aButtons, $sCheckboxName='entry', $bSelectAll=true, $bSelectAllChecked=false, $sCustomHtml='')
setPageMainBoxTitle($sTitle)
displayOrdersBlock($sType, $iVendorId)
displayManualOrderWindow($aForm)
Attr AllowedRel this is empty
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
parseHtmlByName($sName, $aVariables, $mixedKeyWrapperHtml=null, $sCheckIn=CH_WSB_TEMPLATE_CHECK_IN_BOTH)
displayAddToCartJs($iVendorId, $iModuleId, $iItemId, $iItemCount, $bNeedRedirect=false, $bWrapped=true)
getPageCodeResponse($sMessage)
static items2array($mixed)