Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • First Name
  • Last Name

Recent Profile Visitors

219 profile views

shobhitverma's Achievements


Newbie (1/14)




Community Answers

  1. Fixed: I had the same issue with PS 1.7 There are several errors. Error found : StartTag: invalid element name in must_have_module_list.xml file. Error found: Premature end of data in tag GBP line 1 in must_have_module_list.xml file. Error found: Premature end of data in tag price line 1 in must_have_module_list.xml file. Error found: Premature end of data in tag module line 1 in must_have_module_list.xml file. Error found: Premature end of data in tag modules line 1 in must_have_module_list.xml file. I have just removed the file must_have_module_list.xml, this file is located under config/xml/must_have_module_list.xml Ps. Don't delete the file rename it, so you still have back up.
  2. public function postProcess() { if (Tools::getIsset('submitAddadditional_service')) { $this->redirect_after = Context::getContext()->link->getAdminLink('AdminGCardeliverycity', true) . '&updatecitydelivery&id_citydelivery=' . Tools::getValue('id_citydelivery'); } parent::postProcess(); }
  3. https://www.prestashop.com/forums/topic/906668-adding-form-field-dynamically-in-helper-form-prestashop-16/#comment-2978263
  4. I have done this by helper list, while rendering the form I am returning a render list also, check renderAdditionalOptionsList() usage public function renderForm() { $id_citydelivery = (int) Tools::getValue('id_citydelivery'); $citydeliveryObj = new CityPortModel($id_citydelivery); if (Validate::isLoadedObject($citydeliveryObj)) { $_legends = $citydeliveryObj->legend; $_legend_array = explode(',', $_legends); foreach ($_legend_array as $_legend) { $this->fields_value['legend_' . $_legend] = $_legend; } } $temp = $this->fields_value; $fields_form_1 = array( 'form' => array( 'legend' => array('title' => $this->l('Price and Delivery Destination Manager'), 'icon' => 'icon-cogs'), 'input' => array( array( 'type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => false, 'lang' => false, 'options' => array( 'query' => $this->getCountries(), 'id' => 'value', 'name' => 'name' )), array( 'type' => 'text', 'label' => $this->l('Portname'), 'name' => 'portname', 'size' => 255), array( 'type' => 'hidden', 'name' => 'id_citydelivery' ), array( 'type' => 'text', 'label' => $this->l('Per m3'), 'name' => 'perm3', 'size' => 255), array( 'type' => 'text', 'label' => $this->l('Service charges'), 'name' => 'servicecharges', 'size' => 255), array( 'type' => 'text', 'label' => $this->l('Insurance'), 'name' => 'insurance', 'size' => 255), array( 'type' => 'text', 'label' => $this->l('Inspection'), 'name' => 'inspection', 'size' => 255), array( 'type' => 'text', 'label' => $this->l('Certificate'), 'name' => 'certificate', 'size' => 255), array( 'type' => 'checkbox', 'label' => $this->l('Service legend'), 'name' => 'legend', 'required' => false, 'lang' => false, 'values' => array( 'query' => $this->getLegends(), 'id' => 'value', 'name' => 'name' )), array( 'type' => 'switch', 'label' => $this->l('Active'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Active')), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Inactive')))), ), 'submit' => array( 'title' => $this->l('Save'), 'type' => 'submit' ), 'buttons' => array( array( 'href' => AdminController::$currentIndex . '&token=' . Tools::getAdminTokenLite($this->name), 'title' => $this->l('Cancle'), 'icon' => 'process-icon-cancel' ) ) ), ); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->module = $this; $helper->name_controller = $this->name; $helper->toolbar_scroll = true; $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $this->fields_form = array(); $helper->identifier = $this->identifier; $helper->submit_action = 'submitAddcitydelivery'; $helper->currentIndex = AdminController::$currentIndex; $helper->token = Tools::getAdminTokenLite($this->name); $helper->tpl_vars = array( 'fields_value' => $this->getFormValues($citydeliveryObj, $temp), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); $_1 = $helper->generateForm(array($fields_form_1)); $return = $_1; if ($this->display != 'add') { $return .= $this->renderAdditionalOptionsList($id_citydelivery); } return $return; } public function initPageHeaderToolbar() { if ($this->display == 'edit' || $this->display == 'add') { $this->page_header_toolbar_btn['back_to_list'] = array( 'href' => Context::getContext()->link->getAdminLink('AdminGCardeliverycity', true), 'desc' => $this->l('Back to list', null, null, false), 'icon' => 'process-icon-back' ); } parent::initPageHeaderToolbar(); } function getFormValues($citydeliveryObj, $temp) { $arrTwo = array( 'id_citydelivery' => Tools::getValue('id_citydelivery', $citydeliveryObj->id_citydelivery), 'id_country' => Tools::getValue('id_country', $citydeliveryObj->id_country), 'portname' => Tools::getValue('portname', $citydeliveryObj->portname), 'perm3' => Tools::getValue('perm3', $citydeliveryObj->perm3), 'servicecharges' => Tools::getValue('servicecharges', $citydeliveryObj->servicecharges), 'insurance' => Tools::getValue('insurance', $citydeliveryObj->insurance), 'inspection' => Tools::getValue('inspection', $citydeliveryObj->inspection), 'certificate' => Tools::getValue('certificate', $citydeliveryObj->certificate), 'active' => Tools::getValue('active', $citydeliveryObj->active), ); return array_merge($temp, $arrTwo); } protected function renderAdditionalOptionsList($id_citydelivery) { $this->fields_list = array( 'service_name' => array( 'width' => 'auto', 'orderby' => false, 'title' => $this->l('Service Name'), 'type' => 'text', 'search' => false, ), 'service_desc' => array( 'type' => 'text', 'title' => $this->l('Service Description'), 'search' => false, 'orderby' => false, ), 'charge' => array( 'title' => $this->l('Service Charge'), 'type' => 'text', 'search' => false, 'orderby' => false, ), 'active' => array( 'title' => $this->l('Status'), 'active' => 'status', 'type' => 'bool', 'search' => false, 'orderby' => false ) ); $linkToAdditionServiceController = Context::getContext()->link->getAdminLink('AdminAdditionalService', false); $helperList = new HelperList(); $helperList->table = 'additional_service'; $helperList->shopLinkType = ''; $helperList->simple_header = false; //For showing add and refresh button $helperList->identifier = 'id_additional_service'; $helperList->actions = array('edit', 'delete'); $helperList->show_toolbar = false; $helperList->toolbar_btn['new'] = array( 'href' => $linkToAdditionServiceController . '&addadditional_service&id_citydelivery=' . $id_citydelivery . '&token=' . Tools::getAdminTokenLite('AdminAdditionalService'), 'desc' => $this->l('Add new') ); $helperList->title = "Additional Option Manager"; $helperList->currentIndex = $linkToAdditionServiceController; $helperList->token = Tools::getAdminTokenLite('AdminAdditionalService'); $content = $this->getListContent($id_citydelivery); $helperList->listTotal = count($content); return $helperList->generateList($content, $this->fields_list); }
  5. I have an admin controller which displays the list of data on clicking edit on an entry or adding a new entry I am showing renderForm() but after saving the data (either by edit or add) I want to redirect the user to another controller in place of showing the same controller list. function initContent() { parent::initContent(); if (Tools::isSubmit('submit')) { Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminCategories') . '&conf=7'); } }
  6. I have a back office admin controller in which I am using the helper form in renderform() to generate a form and it is working form but I want a functionality to add more field(If user wants to add a new field like add more services on click then create 2 filed one for sevice name and another one for Service price) in that form dynamically.
  7. Hi, I am also having nearly the same requiremnt, have you found any solution? For PS 1.6
  8. Hi, This post is regarding PS 1.6 I am generating invoices PDF, and the length of the invoice PDF is of 2 pages, and both the page have header and footer, but I don't want header from 2nd page onwards for which I tried the following code in \tools\tcpdf\tcpdf.php inside Startpage method nearly on line 4094 if($this->numpages == 1) $this->setHeader(); } It worked, and the header was not getting displayed from 2nd page onwards, but the issue is, it is still leaving margin space from the top of the 2nd page due to which a blank space is getting displayed on the 2nd page. For Resolving I tried the following code on classes\pdf\PDFGenerator.php inside the writePage method. nearly on line 217 if($this->numpages == 1){ $this->setMargins(10, 40, 10); } But by this, all page are getting affected. Any help will be appreciated. IN000009 (18).pdf
  9. Here is the solution which worked for me on two different Prestashop 1.6 and 1.7 which is hosted on different servers but both are using cpanel. Initially, It was not working for me too, but after doing some googling and trying some combination of setting, I came up with a working solution. 1. Go to module cronjobs in your shop back office. 2. select mode as Advanced 3. Save it 4. Now add a new task by clicking plus sign under "CRON TASKS" tab 5. Provide the details: 5.1 Task Description: ANY Thing 5.2 Target Link: URL which you want to be part of cron, but check this URL in a browser window whether it is working or not. 5.3 Task Frequency: must do bellow setting (This setting is not going to work) but should be set as mention below. Every Hour Every day of the month Every Month Every day of the week 5.4 Save Finally, It should look like 1.jpeg attached image. Now there are two ways to proceed further either using Cpanel or SSH By Cpanel 1. Open Cpanel 2. Goto Advanced Tab 3. Click on the cron job 4. Enter your mail and update it 5. Then goto bellow section "Add New Cron Job." 6. Select the setting from the drop-down "Common Setting" this is the setting which will decide at what time script will execute, It will automatically fill bellow some fields 7. But there is one filed is still empty Command, to fill filed do bellow steps 7.1 Go to the shop back office, Goto module cronjobs 7.2 Under Advanced option you will see the command, something like this 0 * * * * curl -k "https://www.abc.com/backoffice/index.php?controller=AdminCronJobs&token=b7ad52c1870c1f7a758c281dd92b333c" 7.3 From this command copy from curl to last 7.4 Past it here 8. Click on Add New Cron Job. Done, Now you will now receive mail when cron job gets executed with the result By SSH 1. Connect SSH 2. Type command "crontab -e" 3. It will open vim editor where you need to mention some code; You can find that code by below steps: 3.1 Go to the shop back office, Goto module cronjobs 3.2 Under Advanced option you will see the command, something like this 0 * * * * curl -k "https://www.abc.com/backoffice/index.php?controller=AdminCronJobs&token=b7ad52c1870c1f7a758c281dd92b333c" 3.3 now in the command change this part "0 * * * *" as per your requirement, This is setting which will tell at what frequency you want to execute cron jobs You can calculate it also very quickly by this link https://crontab.[spam-filter]/ 3.4 Now your command may look like this 0 0 * * * curl -k "https://www.abc.com/backoffice/index.php?controller=AdminCronJobs&token=b7ad52c1870c1f7a758c281dd92b333c" 3.5 Now final code MAILTO="[email protected]" 0 0 * * * curl -k "https://www.abc.com/backoffice/index.php?controller=AdminCronJobs&token=b7ad52c1870c1f7a758c281dd92b333c" 3.6 Past it here 3.7 Save file and Exit 4. Done, Now you will receive mail when the job gets executed.
  10. Hi, Open the file mentioned in error like Notice: Constant UNFRIENDLY_ERROR already defined in /home/istanbuldabuhaftasonu.com/httpdocs/controllers/admin/AdminImportController.php on line 32 Then above file and goto line 32 there you will find some thing like this define('UNFRIENDLY_ERROR', false); and replace it with if(!defined('UNFRIENDLY_ERROR')){ define('UNFRIENDLY_ERROR', false); }
  11. found a way to exactly display a page without header and footer, perfect to put it in a popup like fancybox. you must add a get variable to the URL to display only the content. content_only=1 so for this case of displaying the cart page only, here is the URL index.php?controller=order&content_only=1
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More