Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/26/2022 in all areas

  1. Good Afternoon @kongondo, Hope all is good your side and you've enjoyed your weekend. I'm just pulling a LOAD of products from a stockist and I was wondering (as I believe it is not yet covered in the docs) what is the best way to create products via API. This should then help me to quickly generate products and manage stock levels. I've created the parent product with the usual method. e.g. $product = new Page(); $product->template = "padloper-product"; $product->parent = $pages->get("template=padloper-products"); $product->title = "Test"; $product->padloper_product_stock->price = 22.25; $product->padloper_type = "Trousers"; $product->padloper_categories = "Suits"; $product->save(); But then I'd like to add variants on the fly too. So I also used: $product_variant = new Page(); $product_variant->template = "padloper-product-variant"; $product_variant->parent = $product; $product_variant->title = "Test Variant"; $product_variant->padloper_product_stock->price = 22.25; $product_variant->padloper_type = "Trousers"; $product_variant->padloper_categories = "Suits"; $product_variant->save(); This does indeed add the product as a variant below the aforementioned product. So then I notice that I of course have to enable "use variants" to view them on the custom product dashboard view (they show if you view from admin pages under tree) and can also update the attribute field page reference, so it shows the selectized value. Therefore I've used: $product = $pages->get(10203); $product->of(false); $product->padloper_product_attributes = 'Size'; $product->padloper_product_settings_use_variants = 1; $product->save(); $product->padloper_product_attributes = "Size"; works perfectly, however $product->padloper_product_settings_use_variants = 1 doth not. I also tried $product->padloper_product_settings->use_variants = 1, but I assume this requires some other method to update its value? Is it ok for me to go about this bulk creation as I am so far and could you shed some light on the variant matter if you have a mo. Many Thanks, Look forward to getting this up and ready to show you ? Alex
    1 point
  2. Yes, but this doesn't apply to Padloper. Padloper does not use a ProcessWire field (neither FieldtypeFloat nor FieldtypeDecimal) for price. Instead, it uses a custom Fieldtype that stores price, ex-price, etc. For price, the Padloper custom field utilises a DECIMAL (12,2) sub-field/column ?.
    1 point
  3. @csaggo.com I'd rather @kongondo didn't make this a part of PadLoper as then it leaves this stuff open so specific user use cases. Go with that and bet that he won't add it as a feature as it wouldn't make sense ??
    1 point
  4. @alexmoh yeah i thought you suggested making it part of padloper itself, but custom field on the template makes more sense as there will be all kinds of different cases/needs.
    1 point
  5. @csaggo.com if you just want a short hand field, you can literally do as I suggested. Use the title field supplied as long version, then create a new field called shorthand attribute name and assign it to the padloped-attribute-option template. Otherwise, you can gamble on changing the hook as I have done and taking that extra server load.
    1 point
  6. Yeah, good idea. It does create extra work for your editors though. Hopefully, they can live with that.
    1 point
  7. Agreed, I did think that this might be rather resource hungry. But, so far so good. And like with my stupid amount of variants and products in general, that is with a TON of attribute options. The other conclusion I had was that people could alternatively add another field to that template, perhaps called shorthand/abbreviated for instance. And then use the long form name to search and have an alternative short form name for mapping or front end usage.
    1 point
  8. I was thinking about this argument and this is something I also wish that could be improved. There doesn't seem to be a roadmap anymore. The current roadmap is from 2019: https://processwire.com/about/roadmap/ I think it would be nice to revive the roadmap or at least make a poll for what the community is wishing for the most. The last poll was at the beginning of 2021. The current approach that a feature will be added if @ryan has the need for it on a project is not bad, but that leads to many developer centric and less client centric features, which I personally often don't use, because there are already so many developer centric features. ?
    1 point
  9. I use sass with tailwind. Also in my opinion purgecss is must have with tailwind to remove all unnecessary css. This is a good read, it nails just how I have felt about BEM and many other ways to css: https://adamwathan.me/css-utility-classes-and-separation-of-concerns/ I do like vanilla css, but writing scalable, easy to maintain css is very difficult. Tailwind helps me a lot regarding that and doesn't take away css/sass/less when I want it. My first reaction to utility frameworks was that those are worst idea ever. Glad I gave em chance!
    1 point
  10. The ID of trash is 7, not 49. Depending on your need, you could do: $untrashedPages = $pages->find("template=some-template, status<" . Page::statusTrash); //$untrashedPages = $pages->find("template=some-template, has_parent!=7"); //$untrashedPages = $pages->find("template=some-template, has_parent!=" . $config->trashPageID); FYI, statusTrash = 8192
    1 point
×
×
  • Create New...