Jump to content

basvandertogt

Members
  • Posts

    17
  • Joined

  • Last visited

About basvandertogt

  • Birthday 11/16/1983

Profile Information

  • Location
    Nijmegen
  • Activity
    Developer

Recent Profile Visitors

185 profile views

basvandertogt's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Hello! Is there a module available where i can let the user choose the amount of products he/she wants to see per page? Default you can choose how many products you want to show per page. But i want to let the user decide it. Kind regards, Bas
  2. I check the admin demo but i can't find where i can relate other products on the product page.
  3. Thank you for your answer. Do i need "Related simple" or "Related Products Advanced" on this page http://www.prestahouse.com/en/17-ps-16?id_category=17&n=14 ? And where can i download the demo?
  4. I have a product as pack and i want to relate other pack products to this product.
  5. Long time ago with no answers so i will answer this myself :-) I added this in the controller: public function ajaxProcessUpdatePositions() { $way = (int)Tools::getValue('way'); $id_quicklinks = (int)Tools::getValue('id'); $positions = Tools::getValue('faq_category'); if (is_array($positions)) foreach ($positions as $position => $value) { $pos = explode('_', $value); if (isset($pos[2]) && (int)$pos[2] === $id_quicklinks) { if (isset($position) && $this->updatePosition($way, $position, $id_quicklinks)) echo 'ok position '.(int)$position.' for id '.(int)$pos[1].'\r\n'; else echo '{"hasError" : true, "errors" : "Can not update id '.(int)$id_quicklinks.' to position '.(int)$position.' "}'; break; } } } public function updatePosition($way, $position, $id) { if (!$res = Db::getInstance()->executeS(' SELECT `id_faq_category`, `position` FROM `'._DB_PREFIX_.'faq_category` ORDER BY `position` ASC' )) return false; foreach ($res as $quicklinks) if ((int)$quicklinks['id_faq_category'] == (int)$id) $moved_quicklinks = $quicklinks; if (!isset($moved_quicklinks) || !isset($position)) return false; // var_dump($moved_quicklinks['position']); // < and > statements rather than BETWEEN operator // since BETWEEN is treated differently according to databases return (Db::getInstance()->execute(' UPDATE `'._DB_PREFIX_.'faq_category` SET `position`= `position` '.($way ? '- 1' : '+ 1').' WHERE `position` '.($way ? '> '.(int)$moved_quicklinks['position'].' AND `position` <= '.(int)$position : '< '.(int)$moved_quicklinks['position'].' AND `position` >= '.(int)$position.' ')) && Db::getInstance()->execute(' UPDATE `'._DB_PREFIX_.'faq_category` SET `position` = '.(int)$position.' WHERE `id_faq_category` = '.(int)$moved_quicklinks['id_faq_category'])); }
  6. Hello!, I bought the module "Related Products Pro" but it's not possible to select products with type "Pack of existing products". I e-mailed the owner but i don't get any response. Is there another module available to get this done? Regards, Bas
  7. The ajaxProcessAddAttachment is not called. <?php if (defined('__PS_VERSION_')) { exit('Restricted Access!!!'); } class AdminBlockaboutController extends ModuleAdminController { public function __construct() { $this->table = 'staff'; $this->list_simple_header = FALSE; $this->className = 'StaffModel'; $this->position_identifier = 'id_staff'; $this->lang = TRUE; $this->bootstrap = TRUE; $this->addRowAction('edit'); $this->addRowAction('delete'); $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?') ) ); $this->fields_list = array( 'id_staff' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 25 ), 'name' => array( 'title' => $this->l('Name'), 'width' => 'auto' ), 'function' => array( 'title' => $this->l('Function'), 'width' => 'auto' ), 'photo' => array( 'title' => $this->l('Photo'), 'width' => 'auto', 'name' => 'photo', ), 'active' => array( 'title' => $this->l('Status'), 'width' => 'auto', 'active' => 'status' ), 'position' => array( 'title' => $this->l('Position'), 'width' => '70', 'align' => 'center', 'position' => 'position', ), ); // $this->fields_options = array( // 'contact' => array( // 'title' => $this->l('Contact options'), // 'fields' => array( // 'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array( // 'title' => $this->l('Allow file uploading'), // 'hint' => $this->l('Allow customers to upload files using the contact page.'), // 'type' => 'bool' // ), // 'PS_CUSTOMER_SERVICE_SIGNATURE' => array( // 'title' => $this->l('Default message'), // 'hint' => $this->l('Please fill out the message fields that appear by default when you answer a thread on the customer service page.'), // 'type' => 'textareaLang', // 'lang' => true // ) // ), // 'submit' => array('title' => $this->l('Save')) // ), // ); // $this->fields_options = array( // 'general' => array( // 'title' => $this->l('Content'), // 'fields' => array( // 'PS_BLOCKABOUT_CONTENT' => array( // 'title' => $this->l('Content'), // 'type' => 'textareaLang', //// 'lang' => TRUE, // 'autoload_rte' => 'rte' // ) // ), // 'submit' => array('title' => $this->l('Save')) // ), // ); parent::__construct(); } public function ajaxProcessAddAttachment() { if ($_FILES['photo']['name'] != '') { $file = Tools::fileAttachment('photo'); $sqlExtension = pathinfo($file['name'], PATHINFO_EXTENSION); $mimeType = array('image/png', 'image/x-png'); if (!$file || empty($file) || $sqlExtension != 'png' || !in_array($file['mime'], $mimeType)) return $this->_html .= $this->displayError($this->l('Bad format image file') . ': ' . $this->l('Only png format file accepted')); else { move_uploaded_file($file['tmp_name'], $your_rep . $file['name']); $image_name = $file['name']; } @unlink($file); } } public function renderForm() { $this->fields_form = array( 'tinymce' => TRUE, 'legend' => array( 'title' => $this->l('Staff'), 'icon' => 'icon-user' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 33, 'lang' => FALSE, 'required' => TRUE, ), array( 'type' => 'text', 'label' => $this->l('Function'), 'name' => 'function', 'size' => 33, 'lang' => TRUE, 'required' => TRUE, ), array( 'type' => 'file', 'lang' => FALSE, 'label' => $this->l('Photo'), 'name' => 'photo', // 'display_image' => TRUE, // 'image' => $image_url ? $image_url : false, // 'size' => $image_size, // 'col' => 6, // 'hint' => $this->l('Upload a maker image from your computer.') ), 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('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ), ), 'submit' => array( 'title' => $this->l('Save') ) ); return parent::renderForm(); } }
  8. Ok. Is there a step by step manual available, because i don't get it work.
  9. I build a custom faq module with the ability to manually sort the list in the backend (position field). But i can't get it work. I found this article but it looks this is not working in 1.6 http://neemzy.org/articles/prestashop-de-l-usage-du-champ-position-d-un-modele-dans-le-controleur-de-back-office-correspondant How can i get the update position function work? Can somebody explain me how to do this step by step? Using Prestashop 1.6
  10. Ok, but how to change the $_POST in $_FILE? Can you give a example?
  11. The "hr" button does not have a value. And also the "Show blocks" and "Special character" button. See screenshot. Using PrestaShop 1.6.0.9.
  12. I'm building a simple ModuleAdminController to manage my faq items. However when i change the position of a item, the change is not saved to the database. I don't get any error, it says: "Update successful". What am i doing wrong? <?php if (defined('__PS_VERSION_')) { exit('Restricted Access!!!'); } class AdminBlockfaqController extends ModuleAdminController { public function __construct() { $this->table = 'faq'; $this->list_simple_header = FALSE; $this->className = 'FaqModel'; $this->position_identifier = 'id_faq'; $this->lang = TRUE; $this->bootstrap = TRUE; $this->addRowAction('edit'); $this->addRowAction('delete'); $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?') ) ); $this->fields_list = array( 'id_faq' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 25 ), 'question' => array( 'title' => $this->l('Question'), 'width' => 'auto' ), 'answer' => array( 'title' => $this->l('Answer'), 'width' => 'auto' ), 'id_category' => array( 'title' => $this->l('Category'), 'width' => 'auto' ), 'active' => array( 'title' => $this->l('Status'), 'width' => 'auto', 'active' => 'status' ), 'position' => array( 'title' => $this->l('Position'), 'width' => '70', 'align' => 'center', 'position' => 'position', ), ); parent::__construct(); } public function renderForm() { $sql = new DbQuery(); $sql->select('*'); $sql->from('faq_category', 'c'); $sql->innerJoin('faq_category_lang', 'l', 'c.id_faq_category = l.id_faq_category AND l.id_lang = '.(int)$this->context->language->id); $sql->where('c.active = 1'); $sql->orderBy('position'); $categoriesArray = Db::getInstance()->executeS($sql); $this->fields_form = array( 'tinymce' => TRUE, 'legend' => array( 'title' => $this->l('Faq'), // 'icon' => 'icon-envelope-alt' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Question'), 'name' => 'question', 'size' => 33, 'lang' => TRUE, 'required' => TRUE, ), array( 'type' => 'textarea', 'label' => $this->l('Answer'), 'name' => 'answer', 'size' => 33, 'lang' => TRUE, 'required' => TRUE, 'autoload_rte' => 'rte' ), array( 'type' => 'select', 'label' => $this->l('Category'), 'name' => 'id_category', 'size' => 1, 'lang' => FALSE, 'required' => TRUE, 'options' => array( 'query' => $categoriesArray, 'id' => 'id_faq_category', 'name' => 'title' ), ), 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('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ), ), 'submit' => array( 'title' => $this->l('Save') ) ); return parent::renderForm(); } }
×
×
  • Create New...