Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/31/2024 in all areas

  1. I use the following to create pages via API. I don't know how you have your setup, but you can add the code to a front end template in the content section so you can see the results printed. /* page: status 9 - published (default) 13 - locked / not editable 1033 - hidden 2057 - unpublished 3081 - hidden / unpublished template_id,parent_id,page_status,page_name,page_title,install_description */ $_SESSION['install_log'] =array(); $newp = array( '1,1,9,account2,Account2,User account', '1,1,9,profile2,Profile2,User profile', '1,1,9,register2,Register2,New registration', '1,1,9,tos2,Terms of Service2,Terms of Service', '1,1,9,search2,Search2,Forum search', '1,1,9,banned2,Banned2,Banned user landing page', '1,1,9,help2,Help2,Forum help' ); foreach($newp as $r){ $q =explode(',',$r); $p = new Page(); $p->template = trim($q[0]); $p->parent = trim($q[1]); $p->status =trim($q[2]); $p->name = trim($q[3]); $p->title = trim($q[4]); if($p->save()){ $_SESSION['install_log']['document_create'][$p->title]['id'] = $p->id; $status ='success'; }else{ $status ='failure'; } $_SESSION['install_log']['document_create'][$p->title]['status'] =$status; $_SESSION['install_log']['document_create'][$p->title]['description'] =$q[5]; } function print_array( $data ){ $text =print_r( $data, TRUE ); return '<pre style="font-size:15px; line-height:16px;">'.$text.'</pre>'; } echo print_array($_SESSION['install_log']);
    1 point
  2. @Ivan Gretsky, just wanted to let you know that I'm currently working on the theme feature, but it will require a bit more testing at least. Admittedly this was a bit more complicated than I had originally assumed. That being said, I've just pushed an initial version with a new "view prefix" feature to dev branch, in case you have time / want to give it a try: https://github.com/wireframe-framework/Wireframe/tree/dev. This is pretty much the first option that you described. I ended up rewriting it a couple of times, though, but hopefully have now landed on a solution that makes sense. View prefix can be set in a couple of different ways, but likely the easiest is calling Wireframe::setViewPrefix() in the bootstrap file (wireframe.php): // init Wireframe $wireframe = $modules->get('Wireframe'); $wireframe->init(); // if we're on a theme page, set view prefix if ($page->template == 'theme-home') { $wireframe->setViewPrefix('theme/'); } // render the page echo $wireframe->render(); View prefix will be used whenever Wireframe is rendering a (template/page) view file, component view file, or partial file. It should also work with separate renderer modules, but that's not something I've yet had a chance to test. At least for now default view files are used in case a prefixed version doesn't exist. This could be made configurable, but it felt more intuitive to me that this is (at least) the default behaviour. Note that in the example above I've intentionally used a prefix that is a path, e.g. has "/" — it's not necessary to use a path, it could just as well be something like "alternative-" 🙂 And a big, big warning at the end: I quite literally got this thing up and running half an hour ago. I've done very little testing, so it's entirely possible that there are still issues with it. I hope to get back to it and test properly soon.
    1 point
  3. Hi @bernhard, in the docs-old folder of the module there is a nice section about prices. It says that we can switch to gross prices with a config setting. I was not so sure whether that still applies and how it works with the cart calculations. So I just wanted to share my custom implementation, so that editors can enter gross price and net price will be calculated. I added a field (type RockMoney) "price_gross" in addition to the "rockcommerce_net" field to my product template. And in my ProductPage class, I have a saveReady hook that calculates the net price from the gross price and the vat for that product. /** * Calculates the taxrate of the product * based on the taxrate field of the product * if no custom taxrate is set, the global taxrate is used * * @return float */ public function getTaxrate(): float { return (float) $this->rockcommerce_taxrate ? $this->rockcommerce_taxrate/100 : $this->taxrate(); } /** * Executes when the page is ready to be saved. * * Only executes if price_gross is given and field rockcommerce_net is present. * Calculates the net price and VAT based on the gross price * and tax rate, if a gross price is provided. * It saves the net price to rockcommerce_net. * * @return void */ public function onSaveReady(): void { // only execute if we have price_gross if ($this->price_gross && $this->template->hasField('rockcommerce_net')) { // take price_gross and calculate vat and net price from it using taxrate $taxrate = $this->getTaxrate(); $vat = rockmoney()->parse($this->price_gross)->times($taxrate / (1 + $taxrate)); /** @var \RockMoney\Money */ $priceNet = rockmoney()->parse($this->price_gross)->minus($vat); $this->rockcommerce_net = $priceNet->getFloat(); } } I also use a custom getTaxrate() method from my page class, in case a custom rate is set for that product. Page edit screen
    1 point
  4. I just watched a video about e-mobility and comparison of different energy sources like petrol, e-fules and batteries. Don't want to start a discussion here as it would also violate forum rules, but seeing this picture I thought this look so much like the comparison between a typical WordPress site compared to a typical ProcessWire site 😄
    1 point
  5. This just reminded me of the classic Volkswagen 2.4-liter diesel AAB engine they used in their Transporter vans. It was probably one of the few engines, like the one above, you could fix with a hammer, a few liters of thick oil, and loud swearing.
    1 point
  6. Thx! I'm happy to hear that ? This is a completely recursive multi-level menu using LATTE + RockFrontend magic that should get you started ? <ul class="uk-nav uk-nav-primary uk-margin-top uk-margin-large-bottom"> {* define block that is used for recursion *} {define items, $items, $first} {foreach $items as $item}{* loop all items*} {* define variables for inside the loop *} {var $active = $rockfrontend->isActive($item)} {var $subid = "tm-menu-".$item->id} {var $numc = ($item->numChildren() && $item!==$first) } {* list item markup *} <li n:class="$active ? 'uk-active'"> <a href="{$item->url}" n:attr="rf-toggle: $numc ? '#'.$subid"> {$item->title} <svg n:if="$numc" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--tabler" width="20" height="20" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m6 9l6 6l6-6"></path></svg> </a> {* list for child-items *} <ul id="{$subid}" n:if="$numc" class="uk-nav-sub" {!$active?'hidden'}> {include items, $item->children()->prepend($item), $item} </ul> </li> {/foreach} {/define} {* now include the block for the first level of items *} {include items, $home->children()} </ul>
    1 point
×
×
  • Create New...