Jump to content

jmeile

Members
  • Posts

    36
  • Joined

  • Last visited

Profile Information

  • Activity
    Developer

jmeile's Achievements

Newbie

Newbie (1/14)

12

Reputation

  1. Just for the record: I upgraded my Prestashop to 1.6.0.5. It was working on my server because I still had an old PHP version. Then I updated my server and Prestashop stop working because of PHP 7.2. Ok, then I updated Prestashop to version 1.6.1.24 (last stable version of 1.6). The back-office worked, but the front-end was showing again: "ERR_TOO_MANY_REDIRECTS". I fixed this by setting: "Redirect to the canonical URL" to: "No redirection (you may have duplicate content issues)". It is working now with some small issues. I will now proceed to upgrade to 1.7.x
  2. Yes, this solved my problem as well. Additionally, you will also have to enable mod_filter; otherwise you will get the error: .../.htaccess: Invalid command 'AddOutputFilterByType', perhaps misspelled or defined by a module not included in the server configuration In Ubuntu just run: a2enmod filter Thanks for posting this. Best regards Josef
  3. In deed, on my case, it was an SSL issue. I had an old PrestaShop 1.5.x site, which I upgraded to 1.5.6.3. I only had the files and the database because the website was closed long time ago. So, I didn't recall how my old server was setup. After fixing some MySQL and PHP problems related to the newer versions, I was getting that error. Then I realized that in the Apache VirtuaIHost was doing an SSL redirection. On the PrestaShop backoffice, the option "Enable SSL" was set, so, I removed it and the problem was gone. It seems that the SSL redirection was done twice: once by Apache and the other one by the .htaccess file created by PrestaShop, so, this created an infinite loop that at the end caused that error. Let's see if I get this upgraded to PrestaShop 1.6 and then to 1.7. Thanks for your post. Best regards Josef
  4. Hi flotho I'm glad that you solved your problem. Anyway, I hope that the developers improve the documentation of the HelperForm, HelperList, and HelperOptions classes. There isn't an easy example on how to use them. I think somewhere I saw only one example about the HelperForm class and some on the PrestaShop source, which after lots of coding, gave me some light about the HelperOptions class. To me those classes looks like a powerfull but unexplored resource. It really saves you some coding. Best regards Josef
  5. Hi flotho I don't really recall that error. I just remember having some warnings. I could get ride of someone, but others remained. Anyway, the configuration is working now. I changed my code as follows: After initalizing the fields, I replaced those lines by: $this->helper = new HelperOptions($this); // Module, token and currentIndex $this->helper->id = $this->id; $this->helper->module = $this; $this->helper->name_controller = $this->name; $this->helper->token = Tools::getAdminTokenLite('AdminModules'); $this->helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; // Language $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; // Title and toolbar $this->helper->title = $this->displayName; $this->helper->show_toolbar = true; $this->helper->toolbar_scroll = true; $helper->submit_action = 'submit'.$this->name; $this->helper->toolbar_btn = array( 'save' => array( 'desc' => $this->l('Save'), 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name. '&token='.Tools::getAdminTokenLite('AdminModules'), ), 'back' => array( 'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list') ) ); return $this->helper->generateOptions($fields_options); I'm not sure if it solved your problem. Best regards Josef
  6. Hi Henrik Did you ever find something about this? I'm translating the messages of my shop to Spanish and found that such feature exists in PrestaShop, but I don't seem to find where to set it up. Maybe it is still in development. Best regards Josef
  7. Hi sthnab Unfortunately I didn't find any module to do this. My ads are now gone, so, I haven't tried it anymore. I guess the only way would be to implement a module with a hook on the header. If you can code, this would be the way of doing it: http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module Best regards Josef
  8. Ok, finally I got it working. I was missing the submit button. The only thing I would like to know is if there is someway of changing the name of the submit button. It defaults to "submitOptions". Anyway, I think that the HelperOptions example must be extended. Just showing how the data is arranged didn't help. I had to test a lot till I got it. It works now, but there is still a problem when activating the debug mode: _PS_MODE_DEV_. I still get the following warnings: ( ! ) Warning: Invalid argument supplied for foreach() in C:\wamp\www\prestashop_1-5-4\classes\controller\AdminController.php on line 910 ( ! ) Notice: Undefined property: HelperOptions::$id in C:\wamp\www\prestashop_1-5-4\classes\helper\HelperOptions.php on line 49 It could be that they are only meaningless warnings. So, here is the final code: public function getContent() { if (Tools::isSubmit('submitOptions')) { $blocksocialJM_facebook_widget = Tools::getValue('blocksocialJM_facebook_widget'); $blocksocialJM_twitter_widget = Tools::getValue('blocksocialJM_twitter_widget'); Configuration::updateValue('blocksocialJM_facebook_widget', $blocksocialJM_facebook_widget); Configuration::updateValue('blocksocialJM_twitter_widget', $blocksocialJM_twitter_widget); $this->_clearCache('blocksocialJM.tpl'); } return $this->displayForm(); } public function displayForm() { $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $fields_options = array( 'facebook' => array( 'title' => $this->l('Facebook widget'), 'image' => '../img/admin/information.png', 'description' => $this->l('In order to preview the widget, please go here first: ').'http://developers.facebook.com/docs/plugins', 'fields' => array( 'blocksocialJM_facebook_widget' => array( 'title' => $this->l('Facebook widget code:'), 'type' => 'textarea', 'identifier' => 'id_blocksocialJM_facebook_widget', 'cols' => 60, 'rows' => 5 ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ), ), 'twitter' => array( 'title' => $this->l('Twitter widget'), 'image' => '../img/admin/information.png', 'description' => $this->l('In order to preview the widget, please go here first: ').'https://twitter.com/about/resources/buttons', 'fields' => array( 'blocksocialJM_twitter_widget' => array( 'title' => $this->l('Twitter widget code:'), 'type' => 'textarea', 'identifier' => 'blocksocialJM_twitter_widget', 'cols' => 60, 'rows' => 5 ), ), ), ); $helper = new HelperOptions(); $helper->module = $this; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; $helper->title = $this->displayName; $helper->show_toolbar = true; $helper->toolbar_scroll = true; $helper->toolbar_btn = array( 'save' => array( 'desc' => $this->l('Save'), 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name. '&token='.Tools::getAdminTokenLite('AdminModules'), ), 'back' => array( 'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list') ) ); return $helper->generateOptions($fields_options); }
  9. Ok, now I have two problems, first I get: Notice: Undefined property: HelperOptionsCore::$id in C:\wamp\www\prestashop_1-5-4\classes\helper\HelperOptions.php on line 49 Looking at the code from Helper.php and HelperOptions, there isn't indeed an "id" property that you can set. It is only present in the HelperForm. Then, how do you save the values after submitting the form and update them in the form? The example: http://doc.prestashop.com/display/PS15/HelperOptions must be expanded, ie: it doen't tell you that you have to create a HelperOptions object and it doesn't tell you how to render the forms. Best regards Josef This is my final code: public function displayForm() { $fields_options = array( 'facebook' => array( 'title' => $this->l('Facebook widget'), 'description' => $this->l('In order to preview the widget, please go here first: ').'http://developers.facebook.com/docs/plugins', 'fields' => array( 'blocksocialJM_facebook_widget' => array( 'title' => $this->l('Facebook widget code:'), 'type' => 'textarea', 'identifier' => 'id_blocksocialJM_facebook_widget', 'cols' => 60, 'rows' => 5 ), ), ), 'twitter' => array( 'title' => $this->l('Twitter widget'), 'description' => $this->l('In order to preview the widget, please go here first: ').'https://twitter.com/about/resources/buttons', 'fields' => array( 'blocksocialJM_twitter_widget' => array( 'title' => $this->l('Twitter widget code:'), 'type' => 'textarea', 'identifier' => 'blocksocialJM_twitter_widget', 'cols' => 60, 'rows' => 5 ), ), ), ); $helper = new HelperOptions(); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->module = $this; $helper->title = $this->displayName; $helper->show_toolbar = true; $helper->toolbar_scroll = true; $helper->toolbar_btn = array( 'save' => array( 'desc' => $this->l('Save'), 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name. '&token='.Tools::getAdminTokenLite('AdminModules'), ), 'back' => array( 'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list') ) ); return $helper->generateOptions($fields_options); }
  10. Hi I'm just wondering how to use the HelperOptions. I want to do an own plugging for showing the social networking widgets in the right or the left columns. I got my module working by following the tutorial: http://doc.prestasho...estaShop+module Now I want to have several configuration forms in a page like this: + Facebook widget options | - Widget options [several controls are shown here: text, textarea, etc. ] + Twitter widget options | - Widget options [several controls are shown here: text, textarea, etc. ] So, I followed the example here: http://doc.prestasho...5/HelperOptions And adapted it to my needs: public function displayForm() { $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $fields_form = array( 'facebook' => array( 'title' => $this->l('Facebook widget'), 'description' => $this->l('In order to preview the widget, please go here first: ').'http://developers.facebook.com/docs/plugins', 'fields' => array( 'facebook_widget' => array( 'title' => $this->l('Facebook widget code:'), 'type' => 'textarea', 'identifier' => 'id_facebook_widget', 'cols' => 60, 'rows' => 5 ), ), ), 'twitter' => array( 'title' => $this->l('Twitter widget'), 'description' => $this->l('In order to preview the widget, please go here first: ').'https://twitter.com/about/resources/buttons', 'fields' => array( 'twitter_widget' => array( 'title' => $this->l('Twitter widget code:'), 'type' => 'textarea', 'identifier' => 'id_twitter_widget', 'cols' => 60, 'rows' => 5 ), ), ), ); $helper = new HelperForm(); $helper->module = $this; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; $helper->title = $this->displayName; $helper->show_toolbar = true; $helper->toolbar_scroll = true; $helper->submit_action = 'submit'.$this->name; $helper->toolbar_btn = array( 'save' => array( 'desc' => $this->l('Save'), 'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name. '&token='.Tools::getAdminTokenLite('AdminModules'), ), 'back' => array( 'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'), 'desc' => $this->l('Back to list') ) ); $helper->fields_value['facebook_widget'] = Configuration::get('blocksocialJM_facebook_widget'); $helper->fields_value['twitter_widget'] = Configuration::get('blocksocialJM_twitter_widget'); return $helper->generateForm($fields_form); } At first, I only have two textareas on each form, but later I will add some other controls: select, radio buttons, etc.. For this easy example, I'm getting this: Notice: Undefined index: form in C:\wamp\www\prestashop_1-5-4\cache\smarty\compile\5a40d1b1f19f449c171f7e5a9cd689f798c5b6c9.file.form.tpl.php on line 115 Looking the whole traceback brings me to this line: return $helper->generateForm($fields_form); So, I guess the HelperOptions aren't compatible with the HelperForm, so, the question is: How do I use the HelperOptions? Best regards Josef
  11. I only said that because your problem seemed to be more than only the cart, but also the whole PrestaShop. I even didn't know that you had updated PrestaShop. As bellini13 said, corruption of files would explain that. Anyway, I would advise you before doing an update, copy all your files. That's what I usually do. Sometimes that kind of problems may happen. At least you will be able to downgrade if something goes wrong. Best regards Josef
  12. Hi I ask you again: did you modified the config.inc.php or the defines.inc.php? If yes, please post them here. I would say you added or removed something there that is causing the white page. Anyway, if you still have access to the Back Office, maybe disabling or uninstalling paypal would help. You can also try to see the error messages on the white page by enabling debugging in the defines.inc.php file, by setting this variable: define('_PS_MODE_DEV_', true);
  13. Hi Did you changed something in config.inc.php? Perhaps you removed a semicolon ';', or you didn't close a comment, or you forgot a single ' or double quote ", or you miss a parenthesis. That would be my bet here.
  14. Hi jpryce I see that you posted this long time ago, anyway, if you are still looking for this, in prestashop 1.5.4 is actually posible to do it. No need of changing code. On the other hand, if you want to look for "Customized values", I think this isn't implemented. Anyway, I don't see any practical use for this. On my case, those values include things like size, diameter, volume, etc., so it is nothing worth to be indexed. But if you had a practical case, let me know. Best regards Josef
  15. Hi Thanks to genix for the original fix and to deefaze for the 1.5.2 fix. Anyway, for prestashop 1.5.4, you will have to modify the Search class as follows: class SearchCore { public static function getAttributes($db, $id_product, $id_lang) { /* This function was patched to return convination references: * Post: [FIX] Include search by attribute references in search results http://www.prestashop.com/forums/topic/175234-fix-include-search-by-attribute-references-in-search-results */ if (!Combination::isFeatureActive()) return ''; $attributes = ''; $attributesArray = $db->executeS(' SELECT al.name, pa.reference FROM '._DB_PREFIX_.'product_attribute pa INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (pac.id_attribute = al.id_attribute AND al.id_lang = '.(int)$id_lang.') '.Shop::addSqlAssociation('product_attribute', 'pa').' WHERE pa.id_product = '.(int)$id_product); foreach ($attributesArray as $attribute) $attributes .= $attribute['name'].' '.($attribute['reference'] !="" ? $attribute['reference'].' ' : ''); return $attributes; } } It is escentially the same code from deefaze, but the class is not named Search any more and it doesn't extends from SearchCore. By the way, I tried putting it on the "override/classes/Search.php" folder, but it didn't work. At the end I had to modify the original class. Best regards Josef
×
×
  • Create New...