-
Posts
90 -
Joined
Profile Information
-
Gender
Not Telling
-
Location
Europe
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
LMD's Achievements

Full Member (4/6)
97
Reputation
-
Ok, I've got it to work! Upgrading to MySQL ver. 9.2.0 did not work, changing from MyISAM to InnoDB did not work, but switching from MySQL to MariaDB (ver. 11.7.2) did work. I do not know enough about the technicalities of databases to know why, but I suspect it is that indexing issue from the previously mentioned error message. Thanks again for the help, it's all working as you describe now.
-
I tried a completely fresh install and get a database error -- so I now think it is not a problem with RockCommerce specifically, but with PW and MySQL in general. The error message is complaining about indexing the JSON 'data' column. I shall return here with either a "hurrah" or a "boo-hoo" at a later date! Thanks for the help. And you are right, I should learn DDEV, I've always been put-off being on a Widnows machine.
-
Thanks for the help... I have encountered some technical issues. When I tried to "Enable Product Variations" in RockCommerce settings, I got this error when I tried to "Save": Modules: Failed to init module: RockCommerce - SQLSTATE[42000]: Syntax error or access violation: 3152 JSON column 'data' supports indexing only via generated columns on a specified JSON path. The error disappeared when I reloaded the module page and the box was checked. So I continued... I added "Shoe Size" and "Colour" variations in the "Shop" -> "Variations" tab. Added the rockcommerce_variations field to the product template. Went to my test product page and created a variation for Shoe Size, added the required sizes and prices. Then hit "Save" and got the following Exception errors: PagesEditor: Error saving field "Variation" — SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dotnpw.field_rockcommerce_variation' doesn't exist FieldtypeRockGrid: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dotnpw.field_rockcommerce_variation' doesn't exist Futhermore the selected variation and prices did not get saved. Sure enough, when I looked in the DB the field_rockcommerce_variation table does not exist. I notice in the modules there are three modules that have not been auto-enabled, and nowhere (I noticed) did it mentioned they are needed? FieldtypeReVariations InputfieldRcVariations InputfieldRcPricing FYI using Laragon: PHP ver. 8.3.15 MySQL: 8.0.30 (used MyISAM when I installed PW) Thanks.
-
Hi Bernhard - I purchased RockCommerce a couple of days ago to test out. I have done the quick start tutorial in the docs and it went well. However, I need product variations, but the docs aren't ready yet! The variations I need are for specialist shoes (ballet dancers) and fairly complex - the prices also change depending on the shoe size! Colour Pink White ...etc Size 1 1.5 2 2.5 ... 12 Is there anything I can read/a demo anywhere to get me started? Thanks
-
I can't test this right now, but it might be simpler to put your functions in a separate file (e.g '_funcs.php') and then in '_init.php' use: // in _init.php require_once '_funcs.php'; By using 'require_once', it shouldn't matter how many times '_init.php' gets called, the '_funcs.php' file will only be included once.
-
You can configure VS Code to understand "*.module" files as PHP. Go to "Settings" and then "Text Editor > Files". Under "Associations" press "Add" button and add "*.module" (without the quotes) under Item/key and "php" under Value. Hit "Ok". Might need to restart VS Code for it to take effect. Also, you need a double-asterisk at the front of the comment to get the code hints (and also make sure the variable name is correct/matches!): /** @var TextformatterMarkdownExtra $md_formatter */ $md_formatter = $modules->get("TextformatterMarkdownExtra");
-
[SOLVED] Can't output a repeater item inside a fieldsetpage.
LMD replied to Boost's topic in Getting Started
You forgot to call the fieldname 'button' - you are echoing the repeater items (which uses the ID as toString output). Try this: <div class="caption-cta-wrapper uk-margin-medium-top"> <?php // 'buttons' is a repeater field, so '$btn' is a repeater item foreach($page->hero->buttons as $btn) { echo $btn->button; // <-- fieldname! } ?> </div> -
Checkbox Values Not Saving in Custom Module
LMD replied to froot's topic in Module/Plugin Development
Hi @fruid At the moment it looks like you are grabbing all pages (with parent id = 1) and iterating through them individually to find the ones matching the required menu. With a small number of pages this may well be perfectly fine, but if there are hundreds/thousands of pages it's not very efficient. It would be better to just grab only the pages in the required menu - unfortunately you can't (currently?) do that with a PW selector, but you can use a MySQL query directly combined with a PW find selector -- check out the following thread: -
In this case, you really need to ensure the user has the correct country code, otherwise there is a scenario where they could login to somebody else's account by accident! How about pre-filling the field, but not making it invisible, so the user can see and check it is correct? Maybe with a little country flag icon?
- 9 replies
-
- processlogin
- custom login
-
(and 1 more)
Tagged with:
-
I'm on a mobile, so can't test this but you could try the following... Create a dummy SVG file with a placeholder icon and module name all aligned and styled properly. Give the placeholder icon and text span containing the changable module name unique IDs. I assume the real icons are also SVG (e.g. FontAwesome) and not an image? On page save (with PHP, I assume), open the dummy SVG and regex search-replace the icon (open the icon code too if necessary) and module name. Save new code as a new SVG file. That would be my stating point.
-
Is the number part of the username unique to each user? If so, why complicate things with the region part at all? Especially if you only want the user to enter the number. I fear that by asking too much of the user (making sure their region matches), it will just lead to more tech support enquiries.
- 9 replies
-
- processlogin
- custom login
-
(and 1 more)
Tagged with:
-
This page in the docs helps, but basically inside a module you can use: $this->page; $this->wire('page'); // preferred in Wire-derived classes (i.e. modules) However, for the example you gave above (renderPageTitle()), it might be easier to create a new method for the $page class with a hook. For example: /** * NOTE: the module will need to be set to be 'autoload' => true in the Module Info */ class MyModule extends WireData implements Module, ConfigurableModule { /** * Run when PW is "ready" (like ready.php file) - so it's where you place you ready hooks. */ public function ready() { // Add a hook to define the "renderPageTitle" for the $page class. // Called in your templates with with $page->renderPageTitle() $this->addHook('Page::renderPageTitle', $this, 'renderPageTitleHook'); } /** * The hook code itself (could have been an enclosure on the hook if simple enough) */ public function renderPageTitleHook(HookEvent $event) { $page = $event->object; // the $page class *instance* calling the method $event->return = $page->title; } } Alternatively, this is a good case for using Custom Page Classes (look at the most recent 'site-blank' profile for an example).
-
Displaying created dates instead of last modified dates?
LMD replied to Roadwolf's topic in General Support
In the regular site profile you can find the function that controls this output in the file called '_uikit.php' in the templates folder. Find the function 'ukBlogPost()' and go to the line defining the variable '$date' (see here on Github) to change it. Currently it is looking for the date (modified) and falling back to the created date string 'date|createdStr' -- just remove the 'date|' bit and leave 'createdStr'. Be sure to check the other functions in that file for other places the date may be displayed. -
Strange issue with conditional hooks and repeaters - a bug or user error?
LMD replied to LMD's topic in API & Templates
Ahh, yes, I was not taking into account 'Pages' vs 'Page' objects. Which is silly of me, because the clue is right there in the "$page = $event->arguments(0)" bit of the hook method! Thank you! -
I'm trying to use a conditional "saveReady" hook for repeater items inside a module, but for some reason it isn't firing (and yes, I am making sure to make changes to the repeater when testing!). It works when NOT using a conditional hook (and checking for the template inside the hook function itself), so it's not an issue with anything except the conditional part of the hook. // THIS WORKS public function ready() { $this->addHookAfter('Pages::saveReady', $this, 'myHook'); } public function myHook(HookEvent $event) { $page = $event->arguments(0); if ($page->template->name === 'repeater_gallery') { bd($page); // Tracy dump } } // THIS DOES NOT WORK! public function ready() { $this->addHookAfter('Pages(template=repeater_gallery)::saveReady', $this, 'myHook'); } public function myHook(HookEvent $event) { $page = $event->arguments(0); bd($page); // Tracy dump -- does not get dumped. Is the hook not fired? } I'm using the latest DEV version of ProcessWire (v3.0.222). Is this a bug, or is it me?