Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Spinbox

  1. Hi @kongondo, You have added some nice shortcuts to view the products. Is there a way to add a custom filter to these shortcuts. Or have it set by get variables? I have repetitive products which are locked when it's replaced by a new one. I'm trying to hide locked products since the list is getting pretty long. Thanks,
  2. Thanks @bernhard, that works ? I think I'm going to dive into Latte. It looks like RPB isn't suited for Twig. As both modules are designed with Latte in mind I have to give this a try. Thank you for all your hard work.
  3. Thank you for your reply. First of all, I'm more of a frontender, which could lead to not providing all the things you would like too. Sorry if this leads to unclear questions. Learning each day though. I'm happy to provide a PR but the problem is I'm not sure if I'm right or what I'm doing is the right 'way', or let's say I'm not that confident. What I want to achieve This is what I'm trying to achieve, by adding functions/extensions/filters to twig. <h2>{{translate('Articles','General')}}</h2> <p>{{page.article_date|format_datetime(pattern="d MMMM yyyy")}}</p> Suggestion My suggestion is to have a separate function to load twig (just like Latte is loaded right now), like mentioned in my previous post. This hook would then be able to add these extensions etc. $this->wire()->addHookAfter('RockFrontend::loadTwig', function (HookEvent $event) { /** @var \Twig_Environment $twig */ $twig = $event->return; // Adding custom Twig extensions, functions, and filters $twig->addExtension(new IntlExtension()); $twig->addFunction(new \Twig\TwigFunction('translate', function ($text, $context = "General") { return _x($text, $context, config()->urls->templates . 'language/translations.php'); })); $twig->addFilter(new \Twig\TwigFilter('html_entity_decode', 'html_entity_decode')); $twig->addFilter(new \Twig\TwigFilter('base64_encode', 'base64_encode')); $twig->addFilter(new \Twig\TwigFilter('base64_decode', 'base64_decode')); $twig->addFunction(new \Twig\TwigFunction('bd', function ($dump) { bd($dump); })); // Return the modified Twig environment $event->return = $twig; }); I'm not sure how this would work. My first thought are that I have to copy the contents of this function into a hook and then change the part where it was going to call the renderFileTwig(). That seems like it's prone to errors if the module gets updates but I could be wrong. Any pointers in how to approach this would be welcome.
  4. I used to use TemplateEngine with Twig, where I could hook into twig to add extensions and functions. Is it possible to make it hookable? Right now we can use Twig, but very limited, or am I wrong? Perhaps changing to current function /** * Twig renderer */ protected function renderFileTwig($file, $vars) { try { require_once $this->wire->config->paths->root . 'vendor/autoload.php'; $loader = new \Twig\Loader\FilesystemLoader($this->wire->config->paths->root); $twig = new \Twig\Environment($loader, [ 'debug' => true, ]); $twig->addExtension(new \Twig\Extension\DebugExtension()); $relativePath = str_replace( $this->wire->config->paths->root, $this->wire->config->urls->root, $file ); $vars = array_merge((array)$this->wire('all'), $vars); return $twig->render($relativePath, $vars); } catch (\Throwable $th) { return $th->getMessage() . '<br><br>Use composer require "twig/twig:^3.0" in PW root'; } } to something similar like the Latte renderer /** * Twig renderer */ protected function renderFileTwig($file, $vars) { $twig = $this->loadTwig(); if (!$twig) throw new WireException("Unable to load Twig"); $vars = array_merge((array)$this->wire('all'), $vars); $relativePath = str_replace( $this->wire->config->paths->root, $this->wire->config->urls->root, $file ); return $twig->render($relativePath, $vars); } public function ___loadTwig() { if ($twig instanceof \Twig\Environment) return $this->twig; try { require_once $this->wire->config->paths->root . 'vendor/autoload.php'; $loader = new \Twig\Loader\FilesystemLoader($this->wire->config->paths->root); $twig = new \Twig\Environment($loader, [ 'debug' => true, ]); $twig->addExtension(new \Twig\Extension\DebugExtension()); return $this->twig = $twig; } catch (\Throwable $th) { $this->log($th->getMessage()); return false; } }
  5. Hi @kongondo, you have any updates on the fix?
  6. I'm having an issue where the total price with tax differs from the unit price with tax for a product. The store also has 'All taxes are included in stated prices' checked under tax settings and tax is set at 21%. Is there a fix planned for this or can I hotfix this for now?
  7. Thank you @kongondo, You got me on the right path and I have found the issue. My homepage template has url segments enabled. Once I disable this, the url works. Not sure if this contributes to the problem but I use TemplateEngineFactory. To keep url segments I used a regex to allow anything but paths that start with find-padloper in the template settings. regex:^(?!find-padloper).*$
  8. Thanks for looking into it, I'm going to check what could be the problem..
  9. Hi @kongondo, no I am not running of a sub-directory. I haven't changed anything, so I assume it uses the default language (in my case Dutch). I'm not sure it has anything to do with language. Isn't it just looking for the default language values?
  10. I'm having problems with retrieving attributes for Variants. This hook seems to not triggering for me: $this->addHook("/find-padloper_product_attributes/", $this, 'hookFindPadloperProductAttributesOptions'); When trying to find attributes it returns a 404. I'm using multilingual fields.
  11. I phrased it wrong. I can save it, but I'd rather not have my client confused ? thanks!
  12. After updating I can't simply save an existing product. Is it possible to keep the compare price empty? Looks like it's not possible and it resets to 0. Probably because of the database type.
  13. Great stuff ? Can't wait to use it!
  14. I have managed to save the charge id to the order. For this to work I needed to make captureOrder hookable. This is probably not the right way tough.. $wire->addHookAfter('PadloperProcessOrder::captureOrder', function(HookEvent $event) { $paymentIntent = $event->return; $orderId = $paymentIntent->metadata->reference_id; if ($paymentIntent && $paymentIntent->status === 'succeeded') { $chargeId = $paymentIntent->latest_charge; // Load the order page using the order ID and save the charge ID $orderPage = wire()->pages->get("template=padloper-order, id={$orderId}"); if ($orderPage->id) { $orderPage->of(false); $orderPage->set('stripe_charge_id', $chargeId); $orderPage->save(); } } });
  15. Hi @kongondo, I'm trying to generate product variants on two different installations but when the InputfieldTextTagsSelect tries to get options I get a 404 error.. (It just shows not found page) /find-padloper_product_attributes/?id=2388&field=padloper_product_stock&parent_id=3092&context=options&q=tes I'm running 3.0.229 and 3.0.200 on php 8.2 and Paloper 008 . Are you familiar with this problem?
  16. Thanks, ? I was positive I had that selected, but I can't seem te reproduce ?, don't tell anyone.
  17. Thank you for the pointers, I feel like a newb sometimes, let me cook something up.
  18. I need to include Stripe's Charge ID to invoices. This way some accounting software can relate the payment to the invoice via Stripe. On successfull payment (Order complete); Inside the Stripe Payment Processer I found that 'isSuccessfulPaymentCapture($response, $options = [])' $response is returning it's latest_charge (the charge_id). How can I save this to the order?
  19. In addition, the same padloper-product, padloper_type=1242 (event in this case) should have no shipping fee. I made 2 rates (standard 7,- for normal products, and free). Can I preselect the 'matchedShippingRate', but only if there are only event-typed products in the cart?
  20. Yes I have PowerToys, but the habit of just using 50/50 is strong in me haha. Windows 11 can group 2 windows when you asign them for example with windows+leftarrow. I have to use 2x1080p occasionally when working on location. At home I have used 3440x1440p before this. And dual 1080p before that.
  21. I want to limit the purchase of some 'event'-typed product to 1 per user. Currently when an event is purchased the user get's added to a pagearrayfield which in turn grants them access to some pages. How could I limit the amount of a product to be added to the cart to 1? And after they bought it, how can I prevent them from buying it again?
  22. I'm using a single 4k OLED 42" C2 tv as monitor for over a year now. Using same distance as normal dual monitors I wouldn't go any larger True and 5. If you have no direct window behind you, the glossy screen is great (there are some matte monitors with 4k out there right now, but I personally would go for oled for the deep blacks, which are not that deep on matte screens.. There is also coming an oled monitor from LG with glossy). No burn-in, I do have screensavers and hide the taskbar just in case. Burn-ins really should only occur when something is there for a VERY long time. My pc is on all day long. ^ I have no problem myself I have 120hz, personally I really like that when I move windows around it's a bit smoother Autodimming can be disabled for mine (some program is needed) Small fonts not looking great when it's a particular color combination, like red on yellow. This might be different for different TV panel types. I'm usually splitting the screen in 2, but this is particular a personal preference. (It's possible to have 25%/50%/25% but the 25% would be a bit narrow for a code editor) Perhaps looking at the new (and not yet released) 4k oled monitors could be an option. If OLED is a no-go then I would still have a 42" monitor. One thing; if you are used to this, working on dual monitors is not very pleasant (especially 2x 1080p).
  • Create New...