Jump to content

choppingblock

Members
  • Posts

    49
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by choppingblock

  1. Yes, a page would definitely have been the better choice... But the project is already live, so it's too late to change that.

    Unfortunately, I need the sorting before getting the PageArray. I hoped the parameters would work similar in the find() method...

    I'll check for updates then, maybe it will work in a future release.

    Thanks!

  2. Sorry for reactivating this old thread, but my current issue seems to fit here...

    I have a view with a table of orders. The items can be filtered and sorted, and are returned as a paginated result. Each order item has a property "order_status", which is of type "FieldtypeOptions". The sort order of the options differs from the IDs.

    To get the order pages, I am using something like

    $pages->find("parent=/orders, modified>=1472680800, limit=15, sort=-order_status");

    This sorts by "order_status.id", but i would lilke to sort by "order_status.sort". However, I tried

    $pages->find("parent=/orders, modified>=1472680800, limit=15, sort=-order_status.sort");

    but this seems to have no effect.

    Any ideas how this can be achieved? Am I missing something obvious? Thanks!

  3. I think there should be an identifier field for the assigned user on the order ($page->user_id or something), so that each order knows to which user it belongs (many-to-one relation).

    I could fetch all orders of a user by $pages->find("template=order, user_id=$user").

    Now I would like to have these orders listed under a new tab in each users template (in addition to the "Content" and "Children" tabs I get when I edit a user).

    I don't understand how the system templates are created. Except for the admin template, they don't even use template files. I can change the labels for existing tabs under "Advanced", but how can I add new tabs (and add custom content to them...)?

  4. Good point.

    So then I would create a page "orders" with restricted access, create reference-pages for each user who submits orders and store the orders as child pages of each reference page...

    - orders

    - - user_reference1

    - - - order1

    - - - order2

    - - user_reference2

    - - - order1

    Now I just need to have these orders at hand when I open a user page... I think I'll figure that out.

    Thanks!

  5. I have started to use PW 3 in my latest project and it's working out really great (as expected).

    I have one issue though which I can't figure out.

    I am developing an order system, where users can log in, select a product, make some configurations to it and then order the product.

    The orders are saved as child pages to each user. So far, no problem.

    What I am trying to achieve is to put the orders in a subpage of the user called "orders", for better clarity in the users' structure. So i create a subpage "orders" with the first order of a user, and save the order as a child of this.

    - user

    - - orders

    - - - order1

    - - - order2

    - - - order3

    The problem occurs when the user submits more orders: I can't get the "orders" subpage to put the new order inside it, so an additional "orders" subpage is created with each new order.

    - user

    - - orders

    - - - order1

    - - orders

    - - - order2

    - - orders

    - - - order3

    This is my approach:

        // get the first child of the user page with the template "orders"
        // apparently this does not work as I expected and always returns a NullPage
        $parent = $user->child("template=orders"); 
    
        // if "orders" subpage is a NullPage, create new page
        if ($parent instanceof NullPage) {
            $orderContainer = new Page();
            $orderContainer->parent = $user;
            $orderContainer->template = "orders";
            $orderContainer->title = "Orders";
            $orderContainer->save();
            $parent = $orderContainer;
        }
        
        $order = new Page();
        $order->template = "product-configure";
        $order->title = "Order: " . $order_name;
        $order->parent = $parent;
    
        $order->country = $country;
        $order->publication = $publication;
        $order->comments = $comments;   
    
        $order->save();

    Any hints are appreciated...

  6. Just to add my solution to this issue:

    I ran into this on a Basic Hosting Package on Strato (this is one of the biggest german discount Webhosters).

    None of the above workarounds worked for me, but then I found a hint in the Strato FAQ:

    I needed to disable the filter for guestbook-spam in the security settings, as this was causing a 503 Apache error.

  7. Yep, same with me. In addition, I usually set up a website on a subdomain (like dev.mysite.com), and then switch it over to the main domain once everything is finished... but the subdomain is still displayed in the title in the admin area.

    I think this can be edited by overwriting

    $browserTitle in /wire/templates-admin/default.php

    Or is there another place where this can be done?

  8. I think most of us know that the wysiwig editors can be a pain if you want to input more than just some paragraphs...

    e.g. if you have to work with nested divs in the body of a page. So for some pages, the editor is best left switched off.

    Only solution i can think of at the moment is to create a new template, a new field for body content without editor, and assign the template to the page. Works, but is cumbersome.

    It would be extremely helpful if we could switch the editor on and off via field context settings. What do you think? Is this even possible?

  9. Ah, I think I'm getting closer... this rule is where the path is appended for use in processwire

    RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] 
    

    I solved it with a RewriteRule instead of a redirect

    RewriteCond %{REQUEST_URI} ^.*/new/(.*)
    RewriteRule ^new/(.+)$ http://www.newdomain.com/$1  [R=301,L]

    RewriteRule ^new/(.*)$ http://www.newdomain.com/$1  [R=301,L]
    

    I put this before all the other rewrite conditions. It redirects all requests containing the /new/ path to the new domain homepage, and also appends any path segments which might come after /new/. So www.olddomain.com/new/about/ becomes www.newdomain.com/about/ ...which is exactly what I wanted.

    Thanks for pointing me in the right direction!

    -------------------------------

    Edit: the rewrite condition is not even necessary, and to execute the rule for just www.olddomain.com/new/, the + has to be replaced by a *.

    Yay! :)

    • Like 2
  10. yes, the page I'm redirecting to is the actual page newdomain.com/about/ , redirecting from the (no longer existing) olddomain.com/new/about/

    the result is the same with or without the trailing slash...

    can anyone explain to me, why this ?it=/new/about/ part is appended at all in the first place? i just don't understand why and how this is happening...

  11. I already have that line, followed by a RewriteRule...

    RewriteCond %{THE_REQUEST} ^.*/index.php
    RewriteRule ^(.*)index.php$ /$1 [R=301,NC,L] 
    

    This is for redirecting to the base url, so if someone enters mydomain.com/index.php he gets redirected to mydomain.com

    But even if i remove the rewrite rule line, still the same effect.

    I removed the typo with the second slash, but that seemed not to be the problem.

    I don't really understand how this part "?it=something/else" is generated... Is there a way to cut it off just for the redirect?

  12. I'd like to dig up this topic as I have a similar problem...

    I had a site with two separate sections under one domain, which then was split up into two separate sites with their own domains.

    Now I'm trying to set 301 redirects to all broken links.

    I added this to my .htaccess:

    RedirectMatch 301 /new/(.*) http://www.newdomain.com//$1 
    

    So if you type in www.olddomain.com/new/about you should be redirected to www.newdomain.com/about.

    This does work, sort of. But the result is www.newdomain.com/about?it=new/about, which causes a page not found error.

    How do I get rid of the ?it=new/about part?

  13. Hi all,

    after a longer time working with processwire without stumbling over any issues, I now have come across one (probably only due to my lack of knowledge of rewrite rules).

    What I want to do, is redirect mydomain.com/index.php to mydomain.com with a 301. This should also work for all subdomains as well as without any subdomain.

    How can I do this without messing up the rewrite rules for friendly urls etc. in the .htaccess ? I'm a little afraid to just go and do this by trial and error, as it has to be done on a production site...

    Any help is appreciated!

  14. thanks teppo, for pointing me in the right direction. seems i simply used a wrong syntax / quotation style...

    i used

    $pages->find('categories='.$page->category);
    

    when i should have used

    $pages->find("categories={$page->category}");

    i was sure there was a super simple solution to the problem... and there it is.

    thanks again! :)

  15. figured it out. the LIKE operator is my friend with this... :)

    unfortunately there seems to be a bug or missing feature because it get a

    Exception: Operator '*=' is not implemented in FieldtypePage

    I found a workaround to this here: http://processwire.com/talk/topic/3751-operator-in-fieldtypecomments/

    Though it would be nice to use the "%=" operator instead. Any ideas why this doesn't work? I'm using PW 2.3.0 with the multi language modules.

×
×
  • Create New...