Jump to content

hygap

Members
  • Posts

    17
  • Joined

  • Last visited

  • Days Won

    1

hygap last won the day on July 3 2019

hygap had the most liked content!

1 Follower

Profile Information

  • First Name
    R
  • Last Name
    Smith

Recent Profile Visitors

848 profile views

hygap's Achievements

Newbie

Newbie (1/14)

  • Dedicated Rare
  • First Post Rare
  • Collaborator Rare
  • Week One Done Rare
  • One Month Later Rare

Recent Badges

7

Reputation

  1. Hi @Henry Vermeulen Thanks for your suggested fix. I implemented it in the same fashion and it seemed to solve the problem. However i have recently noticed that this fix seems to have a strange affect on the Prestashop database. In that it is triggers the creation of multiple entries into the ps_employee table using the email set in the fix e.g. [email protected]. Each entry has the first name "Prestashop" and the last name "Marketplace" Are you getting the same behaviour in your database? - Rich
  2. Thanks for your solution @CamilleV :) It has helped me come up with a solution that doesn't involve changing the new `core.js` file. First I had a look at the git hub commits for the classic theme and I think the issue we are facing might have been introduced in the following commit https://github.com/PrestaShop/PrestaShop/commit/aac9a5dff54b379fd5f546ec40aaad0a0d0b941e I then looked into the uncompiled version of `_dev/js/cart.js` from my adapted classic theme (which I also imagine everyone else's themes in this thread are derived from). Make the following changes in `_dev/js/cart.js` (two instances) prestashop.emit('updateCart', { reason: dataset }); to prestashop.emit('updateCart', { reason: dataset, resp, }); then npm compile this back into your `assets/js/theme.js` should allow you to use the new 1.7.8.x `themes/core.js` without having to make your modification. Lastly to note: It seems they have done a bit of work on this file (cart.js) since 1.7.7.x so there might be other changes to watch out for as well. You can see the newest version here: https://github.com/PrestaShop/classic-theme/blob/develop/_dev/js/cart.js (which doesn't even compile in npm for me 😕 ) Hope this helps
  3. Hi Which version of Prestashop are you running? I have it in 1.7.6.9 and it seems to work ok if you just put it in the function prepareProductForTemplate in the ProductListingFrontControler.php For previous versions i think there were some issues with the override not being called by some front end display modules as you list. You might want to try modify the core itself to see if it works on these pages when you edit the core prepareProductForTemplate function. Most places that display product set it up using the ProductListingFrontControler but if it doesn't i would work your way up the stack from that front area (e.g. specials.php ) to see how the product objects being displayed are created. Once you to the point the product is being put through $presenter->present(... you are at the point you can can in the main_variants Hope that helps
  4. Hi All I am trying to make available in the Product List template file all images URLs related to each and every (colour) combination a product has to offer. Currently I believe only the default product image is made available. This is a follow up to the following thread I posted a few years ago https://www.prestashop.com/forums/topic/591040-17x-display-images-of-all-product-varients-on-product-list-category-pages/ where i found a workaround using the prepareProductForTemplate function in the ProductListingFrontController. I was able to query and inject the urls into the main product list variable for theme to pick up. With the new development on PS i am looking to see if there is a better way to do this going forward. I have checked the Extension Concepts page on the Dev Doc as it seems core overrides are discouraged these days. I had a look to see if i could find any hooks that allow you to manipulate the product data before it is shown on a product list. This way I could move the logic into a bespoke module which hooked into the main flow. I couldn't find any. So this would be my first recommendation to any core devs, please add this hook in upcoming versions. Using modules there seems to be ways to work with controllers, however i could not see how this was relevant to what I am trying to achieve. I wondered if it is possible to call functions that retrieve the results of directly in the theme. I would need to access the following calls or something similar: Image::getImages() or $this->context->link->getImageLink(). I could not find any documentation on how to best do this using Prestashop. I don't think any of the Symfony documentation applies to this part of Prestashop yet. So could anyone else offer any advice on how to best achieve this in a way that will age well with Prestashop's development going forward. Is there a better way of doing this?
  5. Just thought I would follow up on this I spoke with one of the core devs in regards to another issue. They confirmed that the starter theme is no longer being maintained and that you should use the classic theme. They said they will update the dev docs to reflect this. See notes from NeOMakinG here: https://github.com/PrestaShop/PrestaShop/issues/14346
  6. Hi I was wondering what the current guidance is on new theme development. When I last developed a new theme for Prestashop I used the Starter theme as a bare bones template and worked from there. The DevDocs still advices this while at the same sending a mixed message by noting that the Starter theme is also no longer maintained by the core team. Checking the repo there doesn't seem to be anyone maintaining it, with no meaningful updates in the last few years. So what do most developers do these days, still use the Starter theme or amend the Classic theme to match their needs? Thanks for any advice in advance.
  7. I'm back! Nothing like find your own two year old thread when trying to fix a new bug in the code your wrote... Presatshop 1.7.5 which now throws this exception using the above fix Lucky I have worked out how to hammer this override back into shape, see below: private function prepareProductForTemplate(array $rawProduct) { $product = (new ProductAssembler($this->context))->assembleProduct($rawProduct); $presenter = $this->getProductPresenter(); $settings = $this->getProductPresentationSettings(); $productOut = $presenter->present($settings, $product, $this->context->language); // Force delete this value from the ProductListingLazyArray > ProductLazyArray. Cya! $productOut->offsetUnset('main_variants', true); // Regenerate (performance hit). $mainVs = $productOut->getMainVariants(); // This time we can play around with the 'main_variants' var however we like foreach ($mainVs as &$varient) { $imgs = Image::getImages($this->context->language->id, $varient['id_product'], $varient['id_product_attribute']); $varient['image_url'] = ''; if (count($imgs) > 0) { $varient['image_url'] = $this->context->link->getImageLink($productOut['link_rewrite'], $product['id_product'] . '-' . $imgs[0]['id_image'], 'home_default'); } } // Put it back (using their method, because why not). $productOut->__set('main_variants', $mainVs); return $productOut; } Hope this helps. P.S. They also seem to have fixed the bug with it not working on the search pages that i filed. Nice work PS! P.S. P.S I still think this would be done better by inserting a custom smarty function that uses Image::getImages & getImageLink to get the info you need directly. If anyone does this please post it up here.
  8. Hi Yes, I ended up using the paid module and it did work. There were a few bugs which I spoke to the developer about that caused a few problems at first but they ultimately fixed them and sent me and updated version. So can recommend. Overall the experience was fairly painful I must admit and I have been reluctant to update my other shops to 1.7 as of yet. I am planning on doing so later in the year as the updates to 1.7 seem like they might be stabilising the branch.
  9. Using the API to update product descriptions when using Multi-shops fails to update all shops. Looking in the database table "ps_product_lang" you will see a that each product's line is duplicated, one line for each shop created in the system. Currently updating the product description via the API only updates the first shops description for that product, leaving all other lines as is. I have tried changing the products default shop and updating again, this has no effect, only the product line with shop id = 1 updates. To remedy this, once the product for shop ID = 1 has been updated via the API, the user must go to the product in the back office and resave it (in "All Shops" mode) this then applies the default description (which is loaded into the product description on the UX) to all the other shops. A Bug report relevant to this error can be found here: http://forge.prestashop.com/browse/PSCSX-6787 Would be good to have a fix on this soon as it makes the API a lot less effective for multi-shops. If I have missed something and it is in fact possible to update I would appreciate the feedback.
  10. For anyone also running into the problem. It turned out to be a DNS issue. See: * https://www.digitalocean.com/community/questions/how-to-solve-curl-error-28-resolving-timed-out-after-10518-milliseconds * https://www.digitalocean.com/community/questions/how-do-i-switch-my-dns-resolvers-away-from-google
  11. I have also run into this problem: Modules & Services > Modules > Selection - Gives the following error: Cannot get catalog data, please try again later. Reason: Data from PrestaShop Addons is invalid, and cannot fallback on cache Modules & Services > Modules > Installed Modules - (with php debugging enabled) - gives me two errors + stack traces: ConnectException in CurlFactory.php line 126: cURL error 28: Resolving timed out after 5515 milliseconds ConnectException in RequestException.php line 49: cURL error 28: Resolving timed out after 5515 milliseconds In Both errors are curl was requesting: https://api-addons.prestashop.com/?format=json&iso_lang=en&iso_code=GB&version=1.7.1.1&method=listing&action=categories I have tried curling this URL from the command line and it returns without a timeout. I have tried solutions already mentioned as follows: 1. Copying https://curl.haxx.se/ca/cacert.pem im /app/cache/dev and /app/cahce/prod which was already present so copied over the top just to be sure 2. Deleting app/cache and having it recreate (checked cacert.pem was present) - Permissions on these files were correct 3. Restarting apache / server 4. Disabling none prestashop modules and overrides 5. set verify_ssl: false in app/config/config.yml None of the above have any effect. The site was running fine until this started happening. I don't have anything specific that I was doing that seem to have caused it. I did install the gmerchent module shortly before this error occurred but I cant say it is related (I tried removing this modules folder and Disabling none Prestashop modules just in case) My dev version on my local machine still works fine. Setup: Prestashop: 1.7.1.1 Apache: 2.4.18 PHP 5.6.30-10+deb.sury.org~xenial+2 curl 7.47.0 - enabled Any ideas or solutions would be greatly appreciated as I am running out of options bar trying a full reinstall. I really don't want to have to do that.
  12. Thanks, yes it is in ProductListingFrontController.php as you state. Since then I have run into a bug where the overide seems not to be called on search results pages. I have submitted a bug as I really don't have a clue why this is happening. http://forge.prestashop.com/browse/BOOM-2994 If anyone has any ideas, I'm all ears?
  13. Hi I am aware there are a couple of posts on the upgrade process from 1.6 to 1.7 however I wanted to start a new thread to document the process I have tried so far for anyone who may follow me. I am trying to upgrade an instance from 1.6.0.14 to 1.7.0.6. I have built a new theme for 1.7 and just want to bring forward all my data from 1.6. Mainly Products, Cats, Customers and Orders. First I tried using the 1-click upgrade (which i upgraded to its current newest version). There is no option to upgrade straight to 1.7 so I downloaded 1.7.0.6 to admin/autoupgrade/latest/prestashop and ran an update using the local directory option. I have tried installing in steps and with debug on and off but the error is always the same. Once the files have been update and I arrive to update the database the following error is presented: All files upgraded. Now upgrading database...[Ajax / Server Error for action upgradeDb] textStatus: "error " errorThrown:"Internal Server Error " jqXHR: " " I get this every time and cannot get any further. I have tried to upgrade the database manually using the upgrade sql files in install/upgrade/sql (replacing PREFIX_ with my db prefix). This gave me many different errors and came up as a no go. I imagine this might be the same reason that the Internal Server Error is being generated. Then I had a chat with some friendly people on the prestashop Gitter chat. They recommended using the following pull request: https://github.com/PrestaShop/autoupgrade/pull/49#partial-pull-merging Used on the repo here: https://github.com/Softizy/autoupgrade I uninstalled and removed the default autoupdate modules and installed this one. Again same failure. I have also managed to update to 1.6.1.11 using the 1-click upgrade (with no errors) and then tried the update, same issue. Looking at my php logs i can see i get the error when I upgrade to 1.7 when I try and update the database step. [13-Mar-2017 19:33:08 Europe/Paris] PHP Fatal error: Call to undefined method Tools::unSerialize() in (/path toadminfolder)/autoupgrade/latest/prestashop/install/upgrade/php/ps1700_stores.php on line 36 I am not sure how to remedy this. (the function exists in classes/Tools.php) Anyway lots of attempts no success. Finally I was recommended this add on. Which I may try next as I cannot think of anything else that might work. https://addons.prestashop.com/en/data-migration-backup/8934-migrationpro-prestashop-to-prestashop-migration-tool.html I would rather upgrade manually rather that resorting to 3rd party add-ons however it seems not possible in this case untill the 1-click update is improved. Any thoughts welcome?
  14. Just thought I would update. I achieved what I was looking for by overriding prepareProductForTemplate in the CategoryController: private function prepareProductForTemplate(array $rawProduct) { $product = (new ProductAssembler($this->context))->assembleProduct($rawProduct); $presenter = $this->getProductPresenter(); $settings = $this->getProductPresentationSettings(); $productOut = $presenter->present($settings, $product, $this->context->language); foreach ($productOut['main_variants'] as &$varient) { $imgs = Image::getImages($this->context->language->id, $varient['id_product'], $varient['id_product_attribute']); $varient['image_url'] = ''; if(count($imgs) > 0) { $varient['image_url'] = $this->context->link->getImageLink($productOut['link_rewrite'], $product['id_product'] . '-' . $imgs[0]['id_image'], 'home_default'); } } return $productOut; } There would then need to be code in the smarty template to pick up on the new var $product.main_variants[x].image_url Still needs a bit of work to pass alt and data-full-size-image-url but hopefully you get the idea. --- Any comment on if this is the best approach still welcome.
×
×
  • Create New...