function init() { parent::init(); $cat_id = $this->app->stickyGET('category_id'); if ($this->options['freelance_result_page'] == '') { $this->add('View_Error')->set('Please Specify Designer Design page Url First'); return; } $customer = $this->add('xepan\\commerce\\Model_Customer'); $cus_j = $customer->join('freelancer_cat_customer_asso.customer_id'); $cus_j->addField('freelancer_category_id'); $customer->addCondition('status', 'Active'); $customer->addCondition('freelancer_category_id', $cat_id); $customer->addExpression('total_sale_design')->set(function ($m, $q) { return $m->add('xepan\\commerce\\Model_QSP_Detail')->addCondition('item_designer_id', $q->getField('id'))->sum('quantity'); }); // $contact->dsql()->group('designer_id'); $c = $this->add('CompleteLister', null, null, ['view\\tool\\freelancerlisting']); $c->setModel($customer); $c->add('xepan\\cms\\Controller_Tool_Optionhelper', ['options' => $this->options, 'model' => $customer]); $c->addHook('formatRow', function ($l) { if ($l->model['image']) { $l->current_row_html['profile_image'] = $l->model['image']; } else { $l->current_row_html['profile_image'] = "vendor/xepan/commerce/templates/images/avatar.jpg"; } }); }
function init() { parent::init(); if (!in_array($this->options['layout'], ['login_view', 'forget_password', 'new_registration', 'micro_login'])) { $this->add('View_Error')->set('View (' . $this->options['layout'] . ') Not Found'); return; } $layout = $this->app->stickyGET('layout'); if ($layout) { $this->options['layout'] = $layout; } $view_url = $this->api->url(null, ['cut_object' => $this->name]); $this->on('click', 'a.xepan-login-panl-loadview', function ($js, $data) use($view_url) { return $this->js()->reload(['layout' => $data['showview']], null, $view_url); }); if ($this->options['show_micro_login']) { $ml_view = $this->add('xepan\\base\\View_User_MicroLogin', array('options' => $this->options)); $this->app->stickyForget('options'); return; } if (!$this->app->auth->isLoggedIn()) { switch ($this->options['layout']) { case 'login_view': $user_login = $this->add('xepan\\base\\View_User_LoginPanel', array('options' => $this->options)); $this->app->stickyForget('layout'); break; case 'forget_password': $f_view = $this->add('xepan\\base\\View_User_ForgotPassword', array('options' => $this->options)); $this->app->stickyForget('options'); break; case 'new_registration': $r_view = $this->add('xepan\\base\\View_User_Registration', array('options' => $this->options)); $this->app->stickyForget('options'); break; case 'verify_account': $v_view = $this->add('xepan\\base\\View_User_VerifyAccount', array('options' => $this->options)); $this->app->stickyForget('options'); break; case 'verify_again': $va_view = $this->add('xepan\\base\\View_User_VerifyAgain', array('options' => $this->options)); $this->app->stickyForget('options'); break; case 'reset_form': $va_view = $this->add('xepan\\base\\View_User_ResetPassword', array('options' => $this->options)); $this->app->stickyForget('options'); break; case 'micro_login': break; default: $this->add('View_Error')->set('View Not Found .....specify data-showview attr'); } } else { $this->js()->univ()->loaction($this->api->url($this->options['redirect_url'])); if ($this->options['layout'] == "micro_login") { $this->add('xepan\\base\\View_User_MicroLogin', array('options' => $this->options)); } else { $this->add('xepan\\base\\View_User_AlreadyLoggedin', array('options' => $this->options)); } } }
function init() { parent::init(); $this->addClass('xepan-commerce-search-tool'); $search_result_subpage = $this->options['xepan_commerce_search_result_page']; if (!$search_result_subpage) { $search_result_subpage = "product"; } $label = ""; if ($this->options['search-field-label'] != "") { $label = $this->options['search-field-label']; } $form = $this->add('Form', null, null, ['form/empty']); $search_field = $form->addField('line', 'search', $label)->validate('required'); //->setAttr('PlaceHolder',$this->options['search-input-placeholder']); if ($this->options['search-form-btn']) { if ($this->options['search-button-position'] === "before") { $submit_button = $search_field->beforeField()->add('Button'); } else { $submit_button = $search_field->afterField()->add('Button'); } $submit_button->setIcon('fa ' . $this->options['search-form-btn-icon']); $submit_button->set($this->options['search-form-btn-label']); $submit_button->js('click', $form->js()->submit()); // $form->addSubmit($this->options['search-form-btn-label'] !=""?$this->options['search-form-btn-label']:"Search"); } if ($form->isSubmitted()) { $form->api->redirect($this->api->url(null, array('page' => $search_result_subpage, 'search' => $form['search']))); } }
function init() { parent::init(); $category = $this->add('xepan\\commerce\\Model_Category')->addCondition('id', $_GET['xsnb_category_id']); $category->tryLoadAny(); if (!$category->loaded()) { $this->add('View_Error')->set('Category not found'); $this->template->del('counts'); return; } $message = $this->validateRequiredOption(); if ($message) { $this->template->del('root_wrapper'); $this->add('View_Warning')->set($message); return; } $this->add('xepan\\cms\\Controller_Tool_Optionhelper', ['model' => $category]); $this->setModel($category); $url = $category['custom_link'] ? $category['custom_link'] : $this->options['redirect_page']; $url = $this->app->url($url, ['xsnb_category_id' => $this->model->id]); $description = $this->model['description']; $description = str_replace("{{url}}", $url, $description); $description = str_replace("{{category_id}}", $category->id, $description); $this->template->trySetHtml('category_description', $description); $this->template->trySetHtml('url', $url); }
function recursiveRender() { parent::recursiveRender(); if ($this->options['add_socialshare']) { $this->js(true)->_load('socialshare/jssocials'); $this->js(true)->_css('socialshare/jssocials'); $this->js(true)->_css('socialshare/jssocials-theme-' . $this->options['socialshare_theme']); } }
function init() { parent::init(); $admin_url = "http://www." . $_GET['epan_name'] . ".epan.in/admin/?page=xepan_hr_user"; $website_url = "http://www." . $_GET['epan_name'] . ".epan.in"; $message = $this->app->stickyGET('message'); $this->template->trySet('admin', $admin_url); $this->template->trySet('website', $website_url); $this->template->trySet('message', $message); }
function init() { parent::init(); $category = $this->add('xepan\\commerce\\Model_FreelancerCategory'); $category->addCondition('status', 'Active'); // $contact->dsql()->group('designer_id'); $c = $this->add('CompleteLister', null, null, ['view\\tool\\freelancercategory']); $c->setModel($category); $c->add('xepan\\cms\\Controller_Tool_Optionhelper', ['options' => $this->options, 'model' => $category]); }
function init() { parent::init(); $category = $this->add('xepan\\blog\\Model_BlogPostCategory'); $category->setLimit($this->options['category_count']); $category->addCondition('status', 'Active'); if ($this->options['order']) { $category->setOrder('order', 'asc'); } if ($this->options['group']) { $category->addCondition('group', $this->options['group']); } $cl = $this->add('CompleteLister', null, null, ['view/tool/post/category']); if ($this->options['show_post']) { $assos_j = $category->leftJoin('blog_post_category_association.blog_post_category_id'); $blog_j = $assos_j->leftJoin('blog_post', 'blog_post_id'); $blog_j->addField('title'); $blog_j->addField('post_id', 'id'); $blog_j->addField('blog_status', 'status'); if (!$this->app->auth->isLoggedIn() || !in_array($this->app->auth->model['scope'], ['AdminUser', 'SuperUser'])) { $category->addCondition('blog_status', 'Published'); } $category->setOrder(['order asc', 'post_id asc']); } if (!$category->count()->getOne()) { $cl->template->set('not_found_message', 'No Record Found'); } else { $cl->template->del('not_found'); } $categories = []; $posts = []; foreach ($cat_rows = $category->getRows() as $cat) { if (!isset($categories[$cat['id']])) { $categories[$cat['id']] = $cat['name']; } $posts[$cat['id']][] = ['title' => $cat['title'], 'post_id' => $cat['post_id'], 'status' => $cat['blog_status']]; } if ($this->options['show_post']) { $cl->addHook('formatRow', function ($cl) use($categories, $posts, $category) { $pl = $cl->add('CompleteLister', null, 'cat_post', ['view/tool/post/category', 'cat_post']); $pl->addHook('formatRow', function ($pl_r) use($cl, $posts) { $pl_r->current_row['post_detail_page_url'] = $this->app->url($this->options['post_detail_page'], ['post_id' => $pl_r->model['post_id']]); if ($pl_r->model['status'] == 'UnPublished') { $pl_r->current_row['color'] = 'text-muted'; } }); $pl->setSource($posts[$cl->model->id]); $cl->current_row_html['cat_post'] = $pl->getHTMl(); }); } $cl->setSource($categories); $cl->add('xepan\\cms\\Controller_Tool_Optionhelper', ['options' => $this->options, 'model' => $category]); }
function init() { parent::init(); $search_result_page = $this->options['search_reasult_url']; if (!$search_result_page) { $this->add('View_Warning')->set('Please add a search result page in options'); return; } $form = $this->add('Form', null, null, ['form/empty']); $form_field = $form->addField('line', 'search'); if ($form->isSubmitted()) { $form->api->redirect($this->api->url(null, array('page' => $search_result_page, 'search' => $form['search']))); } }
function render() { if ($this->lister) { $this->lister->js(true)->_load($this->app->url()->absolute()->getBaseURL() . 'vendor/xepan/commerce/templates/js/tool/jquery-elevatezoom.js')->_load($this->app->url()->absolute()->getBaseURL() . 'vendor/xepan/commerce/templates/js/tool/jquery.fancybox.js')->_css("tool/jquery.fancybox-buttons")->_css("tool/jquery.fancybox"); if ($this->options['zoom-effect'] == 'true') { $option_array = array('gallery' => "gal1" . $this->lister->name, 'cursor' => 'pointer', 'galleryActiveClass' => 'active', 'imageCrossfade' => true, 'constrainType' => "height", 'containLensZoom' => true, 'scrollZoom' => true, 'responsive' => true, 'lensShape' => "round", 'lensSize' => '100', 'easing => true', 'zoomWindowPosition' => (int) $this->options['zoom-window-position'], 'zoomType' => $this->options['zoom-type']); if (!trim($this->options['zoom-type'])) { unset($option_array['zoomType']); } $this->js(true)->_selector('.xepan-commerce-item-image-to-zoom')->elevateZoom($option_array); } $this->js('click', 'var ez =$(".xepan-commerce-item-image-to-zoom").data("elevateZoom");ez.closeAll();$.fancybox(ez.getGalleryList({}));return false;')->_selector('.xepan-commerce-item-image-to-zoom'); } parent::render(); }
function init() { parent::init(); // return; if ($this->options['custom_template']) { $path = getcwd() . "/websites/" . $this->app->current_website_name . "/www/view/tool/" . $this->options['custom_template'] . ".html"; if (!file_exists($path)) { $this->add('View_Warning')->set('template not found'); return; } } else { $this->options['custom_template'] = "categorylister"; } $lister = $this->add('xepan\\commerce\\View_CategoryLister', ['options' => $this->options]); }
function init() { parent::init(); if ($this->options['freelance_result_page'] == '') { $this->add('View_Error')->set('Please Specify Designer Design page Url First'); return; } $contact = $this->add('xepan\\base\\Model_Contact'); $item_j = $contact->join('item.designer_id'); $item_j->addField('designer_id'); $contact->addCondition('status', 'Active'); // $contact->dsql()->group('designer_id'); $c = $this->add('CompleteLister', null, null, ['view\\tool\\freelancerlisting']); $c->setModel($contact); $c->add('xepan\\cms\\Controller_Tool_Optionhelper', ['options' => $this->options, 'model' => $contact]); }
function init() { parent::init(); if (!$this->app->auth->isLoggedIn()) { $this->app->redirect($this->options['login_page']); return; } $this->customer = $customer = $this->add('xepan\\commerce\\Model_Customer'); $customer->loadLoggedIn(); // check customer is loaded if (!$customer->loaded()) { $this->add('View_Info')->set('Customer account not found'); return; } $my_account = $this->add('xepan\\commerce\\Tool_MyAccount', null, 'account', null); $this->showMyEpans(); $this->showMyTemplates(); }
function init() { parent::init(); $post = $this->add('xepan\\blog\\Model_BlogPost'); $post->_dsql()->group($post->_dsql()->expr("[0]", [$post->getElement('year')])); $post->addExpression('year_post_count')->set(function ($m, $q) { return $q->expr("count([0])", [$m->getElement('id')]); }); $post->addExpression('month_post_count')->set(function ($m, $q) { return $q->expr("( COUNT([0]) )", [$m->getElement('id')]); }); $cl = $this->add('CompleteLister', null, null, ['view/tool/post/archieve']); if (!$post->count()->getOne()) { $cl->template->set('not_found_message', 'No Record Found'); } else { $cl->template->del('not_found'); } $cl->setModel($post); $cl->add('xepan\\cms\\Controller_Tool_Optionhelper', ['options' => $this->options, 'model' => $post]); }
function render() { $this->app->pathfinder->base_location->addRelativeLocation('epan-components/' . __NAMESPACE__, array('php' => 'lib', 'template' => 'templates', 'css' => array('templates/css', 'templates/js'), 'img' => array('templates/css', 'templates/js'), 'js' => 'templates/js')); // $this->js()->_load('xShop-js'); // $this->api->jquery->addStylesheet('xShop-js'); // $this->api->template->appendHTML('js_include','<script src="epan-components/xShop/templates/js/xShop-js.js"></script>'."\n"); parent::render(); }
function init() { parent::init(); if (!$this->options['customformid']) { $this->add("View_Error")->set('please select any custom form'); return; } $customform_model = $this->add('xepan\\cms\\Model_Custom_Form')->tryLoad($this->options['customformid']); if (!$customform_model->loaded()) { $this->add('View_Error')->set('no such form found...'); return; } $customform_field_model = $this->add('xepan\\cms\\Model_Custom_FormField')->addCondition('custom_form_id', $customform_model->id); if (!$customform_field_model->count()->getOne()) { $this->add("View_Warning")->set('add form fields...'); return; } $this->form = $this->add('Form'); $form = $this->form; if ($this->options['template']) { $form->setLayout('view/tool/form/' . $this->options['template']); } foreach ($customform_field_model as $field) { if ($field['type'] === "email") { $new_field = $form->addField("line", $field['name']); $new_field->validate('email'); } else { if ($field['type'] === "Captcha") { $new_field = $form->addField('line', 'captcha', $field['name']); $new_field->add('xepan\\captcha\\Controller_Captcha'); } else { $new_field = $form->addField($field['type'], $field['name']); } } if ($field['type'] === "DropDown" or $field['type'] === "radio") { $field_array = explode(",", $field['value']); $new_field->setValueList($field_array); } if ($field['is_mandatory']) { $new_field->validate('required'); } } $this->form->addSubmit($customform_model['submit_button_name']); if ($this->form->isSubmitted()) { if ($form->hasElement('captcha') && !$form->getElement('captcha')->captcha->isSame($form['captcha'])) { $form->displayError('captcha', 'wrong Captcha'); } $model_submission = $this->add('xepan\\cms\\Model_Custom_FormSubmission'); $form_fields = $form->getAllFields(); $model_submission['value'] = $form_fields; $model_submission['custom_form_id'] = $this->options['customformid']; $model_submission->save(); $communication = $this->add('xepan\\communication\\Model_Communication_Email_Sent'); $email_settings = $this->add('xepan\\communication\\Model_Communication_EmailSetting')->load($customform_model['emailsetting_id']); $communication->setfrom($email_settings['from_email'], $email_settings['from_name']); $communication->addTo($customform_model['recipient_email']); $communication->setSubject('You have a new enquiry'); $communication->setBody($model_submission['value']); $communication->send($email_settings); if ($customform_model['auto_reply']) { $email_settings = $this->add('xepan\\communication\\Model_Communication_EmailSetting')->load($customform_model['emailsetting_id']); $communication1 = $this->add('xepan\\communication\\Model_Communication_Email_Sent'); $to_array = []; foreach ($customform_field_model as $field) { if (!($field['type'] == "email" and $field['auto_reply'])) { continue; } $to_array[] = $this->form[$field['name']]; } foreach ($to_array as $email) { $communication1->setfrom($email_settings['from_email'], $email_settings['from_name']); $communication1->addTo($email); $communication1->setSubject($customform_model['email_subject']); $communication1->setBody($customform_model['message_body']); $communication1->send($email_settings); } } $form->js(null, $form->js()->reload())->univ()->successMessage("Thank you for enquiry")->execute(); } }
function recursiveRender() { parent::recursiveRender(); }
function render() { $this->js(true)->_load($this->api->url()->absolute()->getBaseURL() . 'vendor/xepan/commerce/templates/js/tool/jquery-elevatezoom.js')->_load($this->api->url()->absolute()->getBaseURL() . 'vendor/xepan/commerce/templates/js/tool/jquery.fancybox.js'); parent::render(); }
function setModel($model) { //action menu item $myaccount_btn = $this->add('View', null, 'myaccount')->setElement('a')->setAttr('data-type', 'myaccount')->addClass('xepan-commerce-myaccount-action btn btn-block btn-primary')->setAttr('href', $this->app->url(null, ['selectedmenu' => 'myaccount']))->set('My Account'); $order_btn = $this->add('View', null, 'order')->setElement('a')->setAttr('data-type', 'order')->addClass('xepan-commerce-myaccount-action btn btn-block btn-primary')->setAttr('href', $this->app->url(null, ['selectedmenu' => 'order']))->set('Order History'); $mydesign_btn = $this->add('View', null, 'mydesign')->setElement('a')->setAttr('data-type', 'mydesign')->addClass('xepan-commerce-myaccount-action btn btn-block btn-primary')->setAttr('href', $this->app->url(null, ['selectedmenu' => 'mydesign']))->set('My Design'); $mytemplate_btn = $this->add('View', null, 'mytemplate')->setElement('a')->setAttr('data-type', 'mytemplate')->addClass('xepan-commerce-myaccount-action btn btn-block btn-primary')->setAttr('href', $this->app->url(null, ['selectedmenu' => 'mytemplate']))->set('My Template'); $setting_btn = $this->add('View', null, 'setting')->setElement('a')->setAttr('data-type', 'setting')->addClass('xepan-commerce-myaccount-action btn btn-block btn-primary')->setAttr('href', $this->app->url(null, ['selectedmenu' => 'setting']))->set('Settings'); // $mydesign_btn = $this->add('View',null,'mydesign')->setElement('a')->addClass('xepan-commerce-myaccount-action btn btn-block btn-primary')->set('My Designs')->setAttr('data-type','mydesign'); // $mytemplate_btn = $this->add('View',null,'mytemplate')->setElement('button')->addClass('xepan-commerce-myaccount-action btn btn-block btn-primary')->set('My Templates')->setAttr('data-type','mytemplate'); // $setting_btn = $this->add('View',null,'setting')->setElement('button')->addClass('xepan-commerce-myaccount-action btn btn-block btn-primary')->set('Settings')->setAttr('data-type','setting'); $this->js(true)->_selector(".xepan-commerce-myaccount-action[data-type='" . $_GET['selectedmenu'] . "']")->closest('div')->addClass('active'); //Default selected Menu if (!($selected_menu = $this->app->stickyGET('selectedmenu'))) { $selected_menu = 'myaccount'; } ${$selected_menu . "_btn"}->addClass('active'); //My Account Info if ($selected_menu == "myaccount") { //remove extra tab spot $this->template->tryDel('order_wrapper'); $this->template->tryDel('mydesign_wrapper'); $this->template->tryDel('setting_wrapper'); $this->template->tryDel('mytemplate_wrapper'); //all email set at spot emails and lister template define at email layout if (!$model->ref('Emails')->count()->getOne()) { $this->template->tryDel('email_wrapper'); } else { $email_lister = $this->add('CompleteLister', null, 'emails', ['view\\tool\\' . $this->options['layout'], 'email_layout']); $email_lister->setModel($model->ref('Emails')); } if (!$model->ref('Phones')->count()->getOne()) { $this->template->tryDel('Contact_wrapper'); } else { $contact_lister = $this->add('CompleteLister', null, 'contacts', ['view\\tool\\' . $this->options['layout'], 'contact_layout']); $contact_lister->setModel($model->ref('Phones')); } //Recent Order $recent_order = $this->add('xepan\\commerce\\Model_SalesOrder')->addCondition('contact_id', $model->id)->setOrder('id', 'desc')->setLimit(5); $this->add('xepan\\base\\Grid', null, 'recentorder', ['view/tool/myaccount-resent-order'])->setModel($recent_order, ['document_no', 'created_at', 'total_amount', 'gross_amount', 'net_amount']); } elseif ($selected_menu == "order") { $this->template->tryDel('mydesign_wrapper'); $this->template->tryDel('setting_wrapper'); $this->template->tryDel('myaccount_wrapper'); $this->template->tryDel('mytemplate_wrapper'); $order = $this->add('xepan\\commerce\\Model_SalesOrder')->addCondition('contact_id', $model->id)->setOrder('id', 'desc'); $order_grid = $this->add('xepan\\base\\Grid', null, 'order_history', ['view/tool/myaccount-resent-order']); $order_grid->setModel($order, ['document_no', 'created_at', 'total_amount', 'gross_amount', 'net_amount']); $order_grid->addQuickSearch(['document_no']); } elseif ($selected_menu == "mydesign") { $this->template->tryDel('order_wrapper'); $this->template->tryDel('setting_wrapper'); $this->template->tryDel('myaccount_wrapper'); $this->template->tryDel('mytemplate_wrapper'); // my_designs $this->add('xepan/commerce/View_CustomerDesign', array('options' => $this->options), 'my_designs'); } elseif ($selected_menu == "setting") { $this->template->tryDel('mydesign_wrapper'); $this->template->tryDel('order_wrapper'); $this->template->tryDel('myaccount_wrapper'); $this->template->tryDel('mytemplate_wrapper'); $this->add('xepan\\commerce\\View_MyAccountSetting', array('options' => $this->options), 'settings'); } elseif ($selected_menu == "mytemplate") { $this->template->tryDel('mydesign_wrapper'); $this->template->tryDel('order_wrapper'); $this->template->tryDel('myaccount_wrapper'); $this->template->tryDel('setting_wrapper'); $this->add('xepan/commerce/View_CustomerTemplate', array('options' => $this->options), 'my_templates'); } $this_url = $this->api->url(null, ['cut_object' => $this->name]); //Js For Reloading the Right Column and passed the type value // return $this->js('click')->_selector('.button.xepan-commerce-myaccount-action')->univ() // ->location($this->app->url(null,['selectedmenu'=>$data['type']])); $this->template->trySet('member_address', empty($model['address']) ? "Update Your information" : $model['address']); $this->template->trySet('member_billing_address', empty($model['billing_address']) ? "Update Your information" : $model['billing_address']); $this->template->trySet('member_shipping_address', empty($model['shipping_address']) ? "Update Your information" : $model['shipping_address']); parent::setModel($model); }
function init() { parent::init(); $edit_cartitem_id = $this->app->stickyGET('edit_cartitem_id'); $item_member_design_id = $this->api->stickyGET('item_member_design'); $item_id = $this->api->stickyGET('xsnb_design_item_id'); $want_to_edit_template_item = $this->api->stickyGET('xsnb_design_template'); $this->api->stickyGET('show_cart'); $this->api->stickyGET('show_preview'); //display cart tool if ($_GET['show_cart'] and $item_id) { $item = $this->add('xepan\\commerce\\Model_Item')->load($item_id); // display the name of item $this->template->trySet('name', $item['name'] . " ( " . $item['sku'] . " ) "); $this->template->trySet('step1_class', 'xepan-designer-step-deactive'); $this->template->trySet('step2_class', 'xepan-designer-step-deactive'); $this->template->trySet('step3_class', 'xepan-designer-step-active'); $this->template->tryDel('designer_tool_wrapper'); $this->template->tryDel('design_preview_wrapper'); $previous_button = $this->add('Button', null, 'previous_button')->addClass('xepan-designer-previous-step-button'); $previous_button->set('previous'); if ($previous_button->isclicked()) { $this->api->stickyForget('show_cart'); $this->js()->univ()->location($this->app->url(null, ['show_preview' => 1, 'edit_cartitem_id' => $_GET['edit_cartitem_id']]))->execute(); } $v = $this->add('View', null, 'add_to_cart', ['view/tool/designer/addtocart'])->addClass('xshop-item'); $v1 = $v->add('View', null, 'sale_price')->setElement('span')->addClass('xepan-commerce-tool-item-sale-price')->set($item['sale_price']); if ($this->options['show_original_price']) { $v2 = $v->add('View', null, 'original_price')->addClass('xepan-commerce-tool-item-original-price')->set($item['original_price']); } else { $this->template->tryDel('original_price'); } if ($this->options['show_shipping_charge'] and !$this->options['shipping_charge_with_item_amount']) { $v->add('View', null, 'shipping_price')->setElement('span')->addClass('xepan-commerce-tool-item-shipping-charge')->set(0); } else { $v->template->tryDel('shipping_price_wrapper'); } $cart_tool = $v->add('xepan\\commerce\\Tool_Item_AddToCartButton', ['options' => $this->options, 'item_member_design' => $item_member_design_id], 'price_addtocart_tool'); $cart_tool->setModel($item); $this->template->tryDel('next_button'); } elseif ($_GET['show_preview']) { $this->template->trySet('step1_class', 'xepan-designer-step-deactive'); $this->template->trySet('step2_class', 'xepan-designer-step-active'); $this->template->trySet('step3_class', 'xepan-designer-step-deactive'); $this->template->tryDel('designer_tool_wrapper'); $this->template->tryDel('add_to_cart_wrapper'); //next button for addto cart button $form_design_approved = $this->add('Form', null, 'check_and_approved_design'); $approved_checkbox = $form_design_approved->addField('checkbox', 'approved', $this->options['approved_design_checkbox_label']); $approved_checkbox->validate('required'); $previous_button = $this->add('Button', null, 'previous_button')->addClass('xepan-designer-previous-step-button'); $previous_button->set('previous'); if ($previous_button->isclicked()) { $this->app->stickyForget('show_preview'); $this->js()->univ()->location($this->api->url(['item_member_design' => $item_member_design_id, 'xsnb_design_item_id' => $item_id, 'xsnb_design_template' => $want_to_edit_template_item]))->execute(); } $next_button = $this->add('Button', null, 'next_button')->addClass('xepan-designer-next-step-button'); $next_button->set('next'); if ($next_button->isclicked()) { // throw new \Exception("first Next".$_GET['edit_cartitem_id'], 1); $form_design_approved->js()->submit()->execute(); } //load designs // $item_model = $this->add('xepan\commerce\Model_Item')->tryLoad($item_id); // if(!$item_model->loaded()){ // $this->add('View_Error',null,'design_preview')->set('Design Not loaded '); // return; // } $model_template_design = $this->add('xepan\\commerce\\Model_Item_Template_Design'); $model_template_design->addCondition('item_id', $item_id)->addCondition('id', $item_member_design_id); $customer = $this->add('xepan\\base\\Model_Contact'); $customer_logged_in = $customer->loadLoggedIn(); if (!$model_template_design->count()->getOne() and $customer_logged_in) { throw new \Exception("some thing happen wrong, design not found"); } $this->add('xepan\\commerce\\Tool_Item_Designer', ['options' => $this->options, 'item_member_design' => $item_member_design_id, 'xsnb_design_item_id' => $item_id, 'printing_mode' => false, 'show_canvas' => false, 'is_start_call' => 0, 'show_tool_bar' => false, 'show_pagelayout_bar' => true, 'show_layout_bar' => false, 'show_paginator' => 0, 'model' => 'primary', 'is_preview_mode' => 1, 'generating_image' => true], 'design_preview'); // $form_design_approved->addSubmit('Next'); if ($form_design_approved->isSubmitted()) { $this->app->stickyForget('show_preview'); $form_design_approved->js()->univ()->location($this->api->url(['show_cart' => 1, 'edit_cartitem_id' => $_GET['edit_cartitem_id']]))->execute(); } } else { //add class $this->template->trySet('step1_class', 'xepan-designer-step-active'); $this->template->trySet('step2_class', 'xepan-designer-step-deactive'); $this->template->trySet('step3_class', 'xepan-designer-step-deactive'); $this->template->tryDel('add_to_cart_wrapper'); $this->template->tryDel('design_preview_wrapper'); //step 1 $next_btn = $this->add('Button', null, 'next_button')->addClass('xepan-designer-next-step-button'); $next_btn->set('Next'); if ($next_btn->isclicked()) { // throw new \Exception($_GET['edit_cartitem_id'], 1); //check for the designed is saved or not if (!$item_member_design_id) { $this->js()->univ()->errorMessage('save your design first')->execute(); } $template_design = $this->add('xepan/commerce/Model_Item_Template_Design')->tryLoad($item_member_design_id); if (!$template_design->loaded()) { $this->js()->univ()->errorMessage('member not found')->execute(); } $contact_model = $this->add('xepan\\base\\Model_Contact')->tryLoad($template_design['contact_id']); if (!$contact_model->loadLoggedIn()) { $this->js()->univ()->errorMessage('not authorize users')->execute(); } $this->js()->univ()->location($this->app->url(null, ['show_preview' => 1, 'edit_cartitem_id' => $_GET['edit_cartitem_id']]))->execute(); } $designer_tool = $this->add('xepan\\commerce\\Tool_Item_Designer', ['options' => $this->options], 'designer_tool'); } }
function setModel($model) { //tryset html for description $this->template->trySetHtml('item_description', $model['description']); $this->template->trySetHtml('name', $model['name']); //specification $spec_grid = $this->add('xepan\\base\\Grid', null, 'specification', ["view/tool/item/detail/" . $this->options['specification_layout']]); $spec_grid->setModel($model->specification()->addCondition('is_system', '<>', true), ['name', 'value']); //add personalized button if ($model['is_designable']) { // add Personalioze View $personalized_page_url = $this->app->url($this->options['personalized_page'], ['xsnb_design_item_id' => $model['id']]); $this->add('Button', null, 'personalizedbtn')->addClass("xepan-commerce-item-personalize btn btn-primary btn-block")->set($this->options['personalized_button_label'] ?: "Personalize")->js('click', $this->js()->univ()->location($personalized_page_url)); } else { $this->current_row_html['personalizedbtn'] = ""; $this->current_row_html['personalizedbtn_wrapper'] = ""; } //price calculation or add to cart button setup //if item is designable than hide "AddToCart" button if ($model['is_saleable']) { $options = ['button_name' => $this->options['addtocart_button_label'], 'show_addtocart_button' => $model['is_designable'] ? 0 : 1, 'show_price' => $this->options['show_price_or_amount'], 'show_multi_step_form' => $this->options['show_multi_step_form'], 'form_layout' => $this->options['multi_step_form_layout'], 'show_shipping_charge' => $this->options['show_shipping_charge'], 'shipping_charge_with_item_amount' => $this->options['shipping_charge_with_item_amount'], 'checkout_page' => $this->options['checkout_page'], 'continue_shopping_page' => $this->options['continue_shopping_page'], 'amount_group_in_multistepform' => $this->options['amount_group_in_multistepform']]; $cart_btn = $this->add('xepan\\commerce\\Tool_Item_AddToCartButton', ['name' => "addtocart_view_" . $model->id, 'options' => $options], 'Addtocart'); $cart_btn->setModel($model); } //add Item Uploadable // if($model['is_allowuploadable'] and $this->options['show_item_upload']){ // // $contact = $this->add('xepan/base/Model_Contact'); // // if(!$contact->loadLoggedIn()){ // // //Todo add login panle here // // $this->add('View_Error',null,'item_upload')->set('add Login Panel Here'); // // return; // // } // // $member_image=$this->add('xepan/commerce/Model_Designer_Images'); // // $images_count = 1; // // if($model['upload_file_label']){ // // $upload_array=explode(',', $model['upload_file_label']); // // $images_count = count($upload_array); // // } // $v = $this->add('View',null,'item_upload'); // $this->api->stickyGET('show_cart'); // if($_GET['show_cart']){ // $v->add('Button')->setLabel('Back')->js('click',$v->js()->reload(array('show_cart'=>0))); // $options = [ // 'button_name'=>$this->options['addtocart_button_label'], // 'show_addtocart_button'=>$model['is_designable']?0:1, // 'show_price'=>$this->options['show_price_or_amount'], // 'form_layout'=>$this->options['multi_step_form_layout'], // 'show_original_price'=>$this->options['show_original_price'] // ]; // $cart_btn = $v->add('xepan\commerce\Tool_Item_AddToCartButton', // [ // 'name' => "addtocart_view_".$model->id, // 'options'=>$options // ]); // $cart_btn->setModel($model); // }else{ // $v->add('View')->setHTML($model['item_specific_upload_hint']); // $up_form = $v->add('Form'); // $multi_upload_field = $up_form->addField('Upload','upload',"") // ->allowMultiple($images_count) // ->setFormatFilesTemplate('view/tool/item/detail/file_upload'); // $multi_upload_field->setAttr('accept','.jpeg,.png,.jpg'); // $multi_upload_field->setModel('filestore/Image'); // $up_form->addSubmit('Next'); // if($up_form->isSubmitted()){ // //check for the image count // $upload_images_array = explode(",",$up_form['upload']); // if($images_count != count($upload_images_array)) // $up_form->error('upload','upload all images'); // $image_cat_model = $this->add('xepan\commerce\Model_Designer_Image_Category')->loadCategory($model['name']); // foreach ($upload_images_array as $file_id) { // $image_model = $this->add('xepan/commerce/Model_Designer_Images'); // $image_model['file_id'] = $file_id; // $image_model['designer_category_id'] = $image_cat_model->id; // $image_model->saveAndUnload(); // } // $up_form->js(null,$v->js()->reload(array('show_cart'=>1,'file_upload_ids'=>$up_form['upload'])))->execute(); // } // } // } parent::setModel($model); }
function render() { parent::render(); if (!$this->app->country->id and !$this->app->state->id) { $this->js(true)->_selector('.xepan-location-tool')->trigger('click'); } }
function render() { if (!isset($_COOKIE['xepan_lead_subscription']) and $this->options['show_as_popup'] === true) { $this->js(true)->_selector('#' . $this->name . "_subscription_model")->modal('show'); } else { $this->js(true)->_selector('#' . $this->name . "_subscription_model")->modal('hide'); } parent::render(); }
function init() { parent::init(); $this->app->addStyleSheet('jquery-ui'); $company_m = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['company_name' => "Line", 'company_owner' => "Line", 'mobile_no' => "Line", 'company_email' => "Line", 'company_address' => "Line", 'company_pin_code' => "Line", 'company_description' => "text", 'company_description' => "text", 'company_logo_absolute_url' => "Line", 'company_twitter_url' => "Line", 'company_facebook_url' => "Line", 'company_google_url' => "Line", 'company_linkedin_url' => "Line"], 'config_key' => 'COMPANY_AND_OWNER_INFORMATION', 'application' => 'communication']); $company_m->tryLoadAny(); $social = $this->add('View', null, null, ['view/schema-micro-data', 'social_block']); $social->template->trySet('company_name', $company_m['company_name']); $social->template->trySet('website_url', $this->app->pm->base_url); $social->template->trySet('website_name', $this->app->current_website_name); $social->template->trySet('logo_url', $company_m['company_logo_absolute_url']); $social->template->trySet('twitter_url', $company_m['company_twitter_url']); $social->template->trySet('facebook_url', $company_m['company_facebook_url']); $social->template->trySet('google_url', $company_m['company_google_url']); $social->template->trySet('linkedin_url', $company_m['company_linkedin_url']); $view = $this->add('View', null, null, ['view/schema-micro-data', 'person_info']); $view->setModel($company_m); $this->app->memorize('next_url', $this->app->page); if (!$this->app->auth->isLoggedIn()) { $f = $this->add('Form'); $f->addSubmit('Free 14 days trial')->addClass('btn btn-primary btn-block xepan-form-free-trial-btn')->addStyle(['font-size' => '42px', 'font-family' => 'Lucida Console']); if ($f->isSubmitted()) { $this->app->redirect($this->options['login_page']); return; } return; } $this->customer = $customer = $this->add('xepan\\commerce\\Model_Customer'); $customer->loadLoggedIn(); if (!$customer->loaded()) { $this->add('View')->addClass('panel panel-danger')->set('You are not a registered customer'); return; } $v = $this->add('View')->setHtml('<span>Creating your website and admin panel. Be with us, it will take less than 1 minute.</span> <img src="vendor\\xepan\\epanservices\\templates\\images\\loader.gif">'); $v->js(true)->hide(); /*FORM TO ASK USER FOR EPAN NAME AND TO CHECK LOGGEDIN*/ if ($this->app->auth->isLoggedIn()) { $form = $this->add('Form', null, 'form'); $form->setLayout('view\\tool\\form\\epantrial'); $form->addField('epan_name')->setAttr(['placeholder' => 'your website name'])->validate('required?Please enter a website name'); $submit_button = $form->addSubmit('Free 14 day Trial')->addClass('btn btn-primary'); $submit_button->js('click', $v->js()->show()); } if ($form->isSubmitted()) { /* Already Tried */ $trial_epan = $this->add('xepan\\epanservices\\Model_Epan'); $trial_epan->addCondition('created_by_id', $customer->id); $trial_epan->addCondition('status', 'Trial'); $trial_epan->tryLoadAny(); if ($trial_epan->loaded()) { $form->js(true, $v->js(true)->hide())->atk4_form('fieldError', 'epan_name', 'You Have already tried!')->execute(); return; } /* DO EPAN WITH THE SAME NAME EXIST */ $epan_name = $form['epan_name']; $myEpans = $this->add('xepan\\epanservices\\Model_Epan'); $myEpans->addCondition('name', strtolower($epan_name)); $myEpans->tryLoadAny(); if ($myEpans->loaded()) { $form->js(true, $v->js(true)->hide())->atk4_form('fieldError', 'epan_name', 'name already taken')->execute(); return; } /* IF CUSTOMER IS LOGGED IN AND EPAN NAME IS UNIQUE THEN CREATE EPAN */ $epan_name = $form['epan_name']; $email_settings = $this->add('xepan\\communication\\Model_Communication_EmailSetting')->tryLoadAny(); try { set_time_limit(60); $this->api->db->beginTransaction(); $this->createEpan($epan_name); // in epan services database, just a new row with specifications of apps $newEpan_inServices = $this->add('xepan\\epanservices\\Model_Epan')->addCondition('name', $epan_name)->tryLoadAny(); $newEpan_inServices['is_published'] = true; $newEpan_inServices->createFolder($newEpan_inServices); $newEpan_inServices->userAndDatabaseCreate(); // individual new epan database $newEpan_inServices->save(); $this->api->db->commit(); } catch (\Exception_StopInit $e) { $this->api->db->commit(); } catch (\Exception $e) { if ($this->api->db->inTransaction()) { $this->api->db->rollback(); } throw $e; if (isset($newEpan_inServices)) { $newEpan_inServices->swipeEverything($epan_name); } $form->js(true, $v->js(true)->hide())->atk4_form('fieldError', 'epan_name', 'Could not create epan, please try again.')->execute(); return; } $user = $customer->user(); $email_id = $user['username']; $this->sendGreetingsMail($email_id, $email_settings); return $this->app->redirect($this->app->url('greetings', ['epan_name' => $epan_name, 'message' => 'We have sent you a welcome mail. Check your email address linked to the account.'])); } }
function init() { parent::init(); // echo'<pre>'; // print_r($this->options); // exit; $message = $this->validateRequiredOption(); if ($message) { $this->template->tryDel('lister'); $this->template->tryDel('footer'); $this->template->trySet('total_count', 0); $this->add('View_Warning')->set($message); return; } $entered_discount_voucher = $this->app->recall('discount_voucher'); $implement_express_shipping = $this->app->recall('express_shipping'); $this->addClass('xshop-cart'); $this->js('reload')->reload(); $cart = $this->add('xepan\\commerce\\Model_Cart'); $totals = $cart->getTotals(); $this->total_count = $totals['total_item_count']; //if no record found then delete other spot if (!$this->total_count) { $this->template->trySet('not_found_message', 'shopping cart is empty'); $this->template->tryDel('footer'); $this->template->tryDel('lister'); $this->template->trySet('total_count', 0); return; } else { $this->template->tryDel('not_found'); } $lister = $this->add('CompleteLister', null, 'lister', ["view/tool/cart/" . $this->options['layout'], 'lister']); $lister->setModel($cart); //discount voucher implementation // if($entered_discount_voucher){ // $discount_voucher_model = $this->add('xepan\commerce\Model_DiscountVoucher')->tryLoadBy('name',$entered_discount_voucher); $discount_amount = $totals['row_discount'] + $totals['row_discount_shipping'] + $totals['row_discount_shipping_express']; // $total = 0; // if($discount_voucher_model->loaded()){ // //get discount amount based on discount voucher condition // $discount_amount = $discount_voucher_model->getDiscountAmount($total_amount_raw, $sum_shipping_charge_raw); // //todo in future individual item wise with discount_voucher based_on condition // } // } // $net_amount = $total_amount + $sum_shipping_charge - $discount_amount; $this->template->trySet('total_count', $this->total_count ?: 0); $this->template->trySet('total_amount', $this->app->round($totals['amount'])); $this->template->trySet('total_shipping_amount', $this->app->round($totals['shipping_charge'])); $this->template->trySet('gross_amount', $this->app->round($totals['amount'] + $totals['shipping_charge'])); $this->template->trySet('discount_amount', $this->app->round($totals['row_discount'])); $this->template->trySet('net_amount', $this->app->round($totals['amount'] + $totals['shipping_charge'])); $count = $this->total_count; //cart item remove action if ($this->options['show_cart_item_remove_button']) { $this->on('click', '.xepan-commerce-cart-item-delete', function ($js, $data) use($count) { $count = $count - 1; $this->add('xepan\\commerce\\Model_Cart')->deleteItem($data['cartid']); $js_event = [$this->js()->_selector('.xepan-commerce-cart-item-count')->html($count), $js->closest('.xepan-commerce-tool-cart-item-row')->hide(), $this->js()->univ()->successMessage('removed successfully'), $this->js()->_selector('.xepan-commerce-tool-cart')->trigger('reload')]; return $js_event; }); } $cart_detail_url = $this->api->url($this->options['cart_detail_url']); $this->template->trySet('cart_detail_url', $cart_detail_url); // show or hide proceed to next button $checkout_page_url = $this->app->url($this->options['checkout_page']); if ($this->options['show_proceed_to_next_button']) { $this->on('click', ".xepan-cart-proceed-to-next-btn", function ($js, $data) use($checkout_page_url) { return $js->redirect($checkout_page_url); }); } else { $this->template->tryDel('proceed_to_next_button_wrapper'); } // discount voucher if (in_array($this->options['show_discount_voucher'], ["true", true, "1", 1])) { $form = $this->add('Form', null, 'discount_voucher', ['form\\empty']); $voucher_field = $form->addField('line', 'discount_voucher'); // $voucher_field->validate('required'); if ($entered_discount_voucher) { $voucher_field->set($entered_discount_voucher); } if (!$discount_amount and $entered_discount_voucher) { $voucher_field->belowField()->add('View')->addClass('text-danger')->set('Not Effective'); } $voucher_field->js('change', $form->js()->submit()); if ($form->isSubmitted()) { if ($form['discount_voucher'] == "" or is_null($form['discount_voucher'])) { $this->app->forget('discount_voucher'); $this->app->forget('discount_voucher_obj'); $this->add('xepan\\commerce\\Model_Cart')->reloadCart(); $this->js()->reload()->execute(); } $discount_voucher = $this->add('xepan\\commerce\\Model_DiscountVoucher'); $message = $discount_voucher->isVoucherUsable($form['discount_voucher']); if ($message == "success") { $this->app->memorize('discount_voucher', $form['discount_voucher']); $this->app->memorize('discount_voucher_obj', $this->add('xepan\\commerce\\Model_DiscountVoucher')->tryLoadBy('name', $form['discount_voucher'])); $this->add('xepan\\commerce\\Model_Cart')->reloadCart(); $this->js()->reload()->execute(); } else { $this->app->forget('discount_voucher'); $this->app->forget('discount_voucher_obj'); $form->displayError('discount_voucher', $message); } } } else { $this->template->tryDel('discount_voucher_wrapper'); } // express shipping if (in_array($this->options['show_express_shipping'], ["true", 1, "1", true])) { $express_form = $this->add('Form', null, 'express_shipping_checkbox', ['form\\empty']); $field_express_shipping = $express_form->addField('checkbox', 'express_shipping', ""); if ($implement_express_shipping) { $field_express_shipping->set(true); } $field_express_shipping->js('change', $express_form->js()->submit()); if ($express_form->isSubmitted()) { if ($express_form['express_shipping']) { $this->app->memorize('express_shipping', 1); } else { $this->app->forget('express_shipping'); } $this->app->redirect(); } } else { $this->template->tryDel('express_shipping_wrapper'); } if ($this->options['show_total_tax_amount']) { $this->template->trySet('tax_amount', $totals['tax_amount']); } else { $this->template->tryDel('tax_amount_wrapper'); } $this->view_font = $this->add('xepan\\commerce\\View_Designer_FontCSS'); $lister->add('xepan\\cms\\Controller_Tool_Optionhelper', ['options' => $this->options, 'model' => $cart]); }
function init() { parent::init(); $categories = $this->add('xepan\\commerce\\Model_Category'); $categories->setOrder('display_sequence', 'asc'); $this->add('xepan\\cms\\Controller_Tool_Optionhelper', ['model' => $categories]); if ($this->options['show_name'] or $this->options['show-category-description-only']) { if ($_GET['xsnb_category_id'] and is_numeric($_GET['xsnb_category_id'])) { $categories->tryLoad($_GET['xsnb_category_id']); if (!$categories->loaded()) { $this->add('View_Error')->set("category not found"); return; } } } //Only Category Description if ($this->options['show-category-description-only'] == "true") { $cat_m = $categories->load($_GET['xsnb_category_id']); //Category id replace because acustomer need category detail then go to the next page with passing category id $content = str_replace("{{category_id}}", $_GET['xsnb_category_id'], $cat_m['description']); $content = str_replace("{{product_page_name}}", $this->options['url_page'], $content); $this->add('View')->setHTML($content); return; } if ($this->options['show_name']) { //Count Only Website Display Item $cat_item_model = $this->add('xepan\\commerce\\Model_CategoryItemAssociation'); $cat_item_j = $cat_item_model->leftJoin('item.document_id', 'item_id'); $cat_item_j->addField('is_saleable'); $cat_item_j->addField('website_display'); $item_doc_j = $cat_item_j->join('document', 'document_id'); $item_doc_j->addField('status'); $cat_item_model->addCondition('status', 'Published'); $cat_item_model->addCondition('is_saleable', 1); $cat_item_model->addCondition('website_display', 1); $cat_item_model->addCondition('category_id', $categories->id); $single_view = $this->add('View', null, null, ["view/tool/category"]); $single_view->setModel($categories); $single_view->template->trySet('item_count', $cat_item_model->count()->getOne()); return; } $this->options['grid-column']; $width = 12; if ($this->options['show-category-column']) { $width = 12 / $this->options['show-category-column']; } $this->col = 'col-md-' . $width . ' col-sm-' . $width . ' col-xl-' . $width; // Define no of sub-category show in parent category if ($this->options['category_show_list']) { $this->options['category_show_list']; } if (!$this->options['url_page']) { $this->add('View_Error')->set('Please Specify Category URL Page Name (page name like.. about,contactus etc..)'); return; } else { $categories->addCondition('status', 'Active'); //todo OR Condition Using _DSQL $categories->addCondition($categories->_dsql()->orExpr()->where('parent_category_id', null)->where('parent_category_id', 0)); // $categories->addCondition('parent_id',Null); $categories->tryLoadAny(); if (!$categories->loaded()) { $this->add('View_Error')->setHTML('No Root Category Found'); return; } $output = "<div class='body epan-sortable-component epan-component ui-sortable ui-selected'>"; $output = "<ul class='sky-mega-menu sky-mega-menu-anim-slide sky-mega-menu-response-to-stack'>"; foreach ($categories as $junk_category) { $output .= $this->getCategory($categories); } $output .= "</ul></div>"; $this->setHTML($output); } //loading custom CSS file // $category_css = 'epans/'.$this->api->current_website['name'].'/xshopcategory.css'; // $this->api->template->appendHTML('js_include','<link id="xshop-category-customcss-link" type="text/css" href="'.$category_css.'" rel="stylesheet" />'."\n"); }
function render() { $this->js(true)->_css("jquery-ui"); parent::render(); }