-
Posts
1,554 -
Joined
-
Last visited
-
Days Won
48
Everything posted by gebeer
-
Link page with multiple pages by field value in backend
gebeer replied to Pavel Radvan's topic in General Support
First you need to add a page reference field to the contract template. I assume you name it 'products' Set it to accept multiple pages Choose type ASM select and product template for allowed templates Now that you have your products field in place, you can write a script to assign the product pages to the contract pages. foreach($pages->find("template=contract") as $cp) { // assuming you have a field $cp->uid with the ids of the products // if you have a comma separated list of ids or the like, convert it to array $uids = explode(',', $cp->uid); // add products for each $id to products field foreach($uids as $id) { $cp->products->add($pages->find("template=product, uid=$id")); } // save the changes $cp->setAndSave('products'); } I would recommend using TracyDebugger Console to run the script. Or you can run it from site/templates/home.php This should assign the correct products to the contract pages and make them editable from the contract pages edit screen. -
Link page with multiple pages by field value in backend
gebeer replied to Pavel Radvan's topic in General Support
If I understand correctly, you want to make the connection between contract and product pages after data import. In the imported data you have a numeric ID that connects contracts to products. Can you please clarify if that numeric ID has been saved to a field on both contract (multiple IDs) and product page (single ID)? Once we know that, it would be quite easy using a small script to make the connection through a page reference field on the contract page that references one or more products. -
Yes, that is why we went with the page tree option. Less headache for developing. Definitely more work, but also more flexibility for the editors.
-
I proposed to either 404 or redirect. So if you redirect to the main admin page and add a message before you redirect, the user doesn't even need to click anywhere and gets there automatically. Better UX IMO. Which items would that be? You can setup your roles/permissions in a way that users only see the menu items for pages/processes they have access to. If your users get access to the page tree, you can use hooks that utilize Page::viewable to remove those pages from the tree that they should not see. You'd have to activate language support (if you haven't already) and then in the settings for each language search through the core translation files to find those strings and then overwrite them.
-
Yes, this is what I would go for. Sth like domain.com/fr/market1/, domain.com/fr/market2/ etc. so you have segments /language/market/ You can either 1. reflect this in your page tree -home --market1 ---page --market2 ---page 2. use URL segments. This would make the routing more complex. 3. You could also use URL hooks with named arguments and do your routing from there. For 2 and 3 you need to make sure that the URLs with market segments resolve to a 404 without segments/hooks in place. I've done something like this at https://www.ziehm.com/en/products/ and https://www.ziehm.com/en/us/product-portfolio/ where /us/ is the market segment. In this case we solved it through the page tree structure. Drawback is that similar pages under default market (no market segment) and us market need to be maintained seperately. EDIT: to avoid maintaining duplicate pages for different markets, you can have a markets parent with markets as children with templates markets and market respectively: Market pages: -markets --europe --asia --africa Then have a page reference field that allows selection of 1 or more markets. Now you use this field in combination with prices or other things. In the rendering logic you can get the price for market by URL segment. You'd need to have the market chooser direct to the respective market segments of the page. In said project we have a market selector page for each market with the languages to choose from https://www.ziehm.com/en/us/market-selector/ If you have those market pages in the tree, you can also link markets to available languages for that market. It was fun and challenging to work that out for said project.
-
I was reading through the thread and had the intution that Login History might have sth to do with your problem. Then I read that. To manually disable the module, you can rename the module folder to .ProcessLoginHistory . Then you can do a modules refresh and you should see the ProcessLoginHistory listed under "Missing" and can remove it from there from the DB. Maybe this will help. Still I think you are having permission issues on the new server since you can't delte old folders. Do you have ssh access to the server? If not, the server admin should be able to help with those issues. The 502 Proxy error signifies a communication breakdown between servers, often caused by issues like server overload, network problems, or configuration errors. Again, hard to debug that from the outside and the server admin should see what is happening exactly. But I guess it is some kind of overload problem caused by too many DB requests or the like since you get that server error too many SQL connections. When you login as Teacher and the page tree doesn't load, you can open the browser dev tools and check for the Responsetab of the XHR request that is happening to fetch the page tree data. In Firefox this should look something like this (where yours likely has a 500 error):
-
module SnipWire - Snipcart integration for ProcessWire
gebeer replied to Gadgetto's topic in Modules/Plugins
@Gadgetto I am struggling with webhooks :-) In the docs it says: * All hookable event handler methods will return an array containing payload Snipcart sent to your endpoint. * In addition, the following class properties will be set: * * $this->payload (The payload Snipcart sent to your endpoint) * $this->responseStatus (The response status your endpoint sent to Snipcart) * $this->responseBody (The response body your endpoint sent to Snipcart) * * (Use the appropriate getter methods to receive these values!) * * How to use the hookable event handler methods (sample): * ~~~~~ * $webhooks->addHookAfter('handleOrderCompleted', function($event) { * $payload = $event->return; * //... your code here ... * }); * ~~~~~ * * PLEASE NOTE: those hooks will currently only work when placed in init.php or init() or ready() module methods! * I have setup a hook for order.completed in the init method of a custom autoload module public function init() { ... // SnipWire Webhooks $this->wire->webhooks->addHookAfter('handleOrderCompleted', $this, 'handleOrderCompleted'); } Issueing post requests to the endpoint returns an empty response body While in the docs it says: when I var_dump($event->object->getResponseBody()) in my handler method, it gives an empty string which explains why the response body is empty. How can I set responseBody from within my hook handler method? There is no setter for that and Webhooks::responseBody is private, so I have no way to set it in my handler. To solve this, I introduced a setter method to the Webhooks class /** * Setter for responseBody. * * @param string $responseBody * @return void * */ public function setResponseBody(string $responseBody) { $this->responseBody = $responseBody; } Now in my handler method I can do $event->object->setResponseBody('{"test": "test"}'); Which results in While I was at it, I also added a setter for responseStatus. Not sure if you still maintain this module, so I will add this to my fork just in case anyone still needs it.- 235 replies
-
- shopping cart
- snipcart
-
(and 2 more)
Tagged with:
-
[SOLVED] $config->pagefileSecure has no affect on trashed pages
gebeer replied to gebeer's topic in General Support
Problem solved. Ryan mentioned in the issue report that only files are protected that are uploaded after the $config->pagefileSecure setting is in place. I was not aware of that and I couldn't find that requirement documented anywhere when doing a search prior to posting this issue. Done a search again which pulled up this forum thread I suggest to add that information to the entry for `$config->pagefileSecure` at https://processwire.com/api/ref/config/ -
[SOLVED] $config->pagefileSecure has no affect on trashed pages
gebeer replied to gebeer's topic in General Support
Issue submitted: https://github.com/processwire/processwire-issues/issues/1911 -
Hello, on PW v3.0.229 when setting $config->pagefileSecure, files (PDF inmy case) are still offered for download, even if the pages for those files reside in the trash. Can anyone confirm that behaviour? IMO assets of trashed pages should not be publicly available and $config->pagefileSecure should take care of that like it does for unpublished pages. Many editors without superuser priviliges aren't even aware of pages in the trash, unless we allow them to see the trash. So they would think that a trashed page is gone for good. In my case I now made the trash visible to those editors. But I also needed to instruct them to unpublish pages before moving them to the trash or delete them from the trash in order to make the files not appear publicly anymore
-
@kongondo any plans for a release date? We have the feature request from our client for batch editing MM pages. Something like how ListerPro does it would be awesome.
-
Same behaviour for me on Linux Firefox/Chromium. Need to activate the TinyMCE plugin. Used latest version 0.1.7. of your module
-
Great module. This really improves UX a lot, especially on larger page edit screens. I can confirm that Ctrl+s is working on Linux Firefox & Chromium (with improved JS version from @dotnetic).
-
RockForms - Simple, secure and versatile forms based on NetteForms
gebeer replied to bernhard's topic in Modules/Plugins
Great stuff as always ? Receivd your newsletter today that features the release of RockForms. Totally did not see this post before. I have read through the docs completely. Quite impressive. You seem to have all the functionality needed for rapidly building forms. Some nice wrappers around the sometimes clumsy Nette API. I've been building forms with Nette before and that was not always a pleasant experience. Great that your module simplifies the process. Will surely use this in upcoming projects. -
Hello Kongondo, we experience a bug in Media Manager v0.1.3. When wanting to choose an image from MM in table view, after checking the red checkbox, the page inside the modal refreshes. In tile view it is working fine. Here's a screencast to illustrate the problem: https://www.awesomescreenshot.com/video/25972032?key=710d115a76a69bcf6642cb3ca72cfe99 There are no errors shown in the console. Problem occurs in all browsers. PW v3.0.208, PHP8.1. Modules jQuery core v1.8.3, jQuery UI v1.9.6
-
Thank you for pointing it out. I added these instructions to my original post.
-
Maybe you want to take a look at https://processwire.com/modules/fieldtype-page-table-extended/ That module hasn't been updated in a while but should have code that can point you in the right direction.
-
Ddev is astonishing! Here are a few notes from a Windows user.
gebeer replied to Greg Lumley's topic in General Support
Glad you found it and thanks for the tips for windows users. There is a dedicated forum thread with tips & tricks: -
How to protect files from being downloaded directly via url
gebeer replied to hintraeger's topic in API & Templates
Code here: and here: might be helpful. This implementation is working for me on several projects. -
Automate Repeater Matrix types creation with RockMigrations
gebeer replied to Ivan Gretsky's topic in RockMigrations
Thanks a lot for your help with testing. I also added the snippet and will have an eye on this for a while. -
Automate Repeater Matrix types creation with RockMigrations
gebeer replied to Ivan Gretsky's topic in RockMigrations
I see. This problem is quite hard to debug because it is not 100% reproducable. For me it is happening only sporadicly and I didn't see it in quite a while now. Would you like to try and put that missing snippet in the createField method and see if the problem goas away? -
Automate Repeater Matrix types creation with RockMigrations
gebeer replied to Ivan Gretsky's topic in RockMigrations
Thanks for spotting this. Did you try this and will it return the correct field type? If so, could you please make a PR? Thank you.