Jump to content

ptjedi

Members
  • Posts

    54
  • Joined

  • Last visited

Posts posted by ptjedi

  1. This is big leap in terms of backoffice management. Can't wait for it to come out!

    Any predictions on when that will happen? Any alpha version released already?

    Great work!

  2. Hi everyone,

    Sometime since I posted something here, but I can't seem to be able to surpass this problem on my own. I've read a bunch of topics that relate to this problem but nevertheless, I fail to fix this pagination display.

    Let me explain and hope someone help me out.

    This is my current structure:

    Home

    • Catalog
      • Catalog (subpage, same type)
        • Product 1
        • Product 2
        • ...
        • Product N

    The script is triggered in the first 'Catalog' in the tree above. The template of this script is similar to the default search.php, where the results are packed into the $out variable and dumped at the end. I don't believe this has anything to do with my problem.

    At the beginning I have:

    $query = "limit=3";
    $products = $page->get("name=produtos")->children($query);
    $count = count($products);

    It returns the correct number of items, and displays the first 3.

    At the end, I have the pager rendering:

    echo $jogadores->renderPager(); 

    And it displays the correct number of pages. However, clicking one of the links, the page refreshes with a new URL, but with the same three results. The URL looks like this example for page 3:

    /path/to/url/page3

    I have turned the "Allow Page Numbers?" on the 'catalog' template, so it should work.

    Thanks in advance!

  3. Not tested, but you can put this the top of the template to test the domain $_SERVER['HTTP_HOST'] and serve a different template depending on it

    if($_SERVER['HTTP_HOST'] == m.domain.com) {
    // code for mobile
    }else{
    // normal code
    }
    

    That's an idea I had as well. I was just checking if anyone had a more elegant solution to the problem.

    Thank you and that will come in handy, however my question resides more on the part of "theme/template switching" rather than mobile detection.

  4. I've checked that module (thanks diogo and jukooz) but like jukooz said, it seems I have to have a separate tree of pages for this website. Wouldn't it be simpler to have all my templates duplicated (head.inc to m-head.inc, for example) and then figure a way to match things? In other words, if I needed a theme switcher (and no extra domain) would that module seem fit for the job in your opinion?

  5. Hi all,

    I was thinking what's the best approach for a multi-themed website. The point of this is to build a website that has a simple website for mobile within a subdomain (m.domain.com, for example). How can this be achieved? I assume everything would be easy if there would be another "/site" folder. Is this it? If so, how can that be achieved?

    Many thanks in advance!

    Cheers

  6. Yes, Soma, I agree with you on that. I believe I have to place the language alias before. And about that, I have a question that is connected to this problem. When I want to link to a page, instead of typing the URL with the normal name, I would like to get the URL depending on the language I am at. Here's what I do, but I think this solution is not vert elegant...

    $homepage = $pages->get("/");
    $children = $homepage->children->find("name=pagename");
    $child = $children->first();
    

    Then I use $child->url for the url's link. Is there a easier way?

  7. I think this will just depend on how and where you are setting the language. You'll want to make sure you are setting $user->language somewhere before your search (and before any output).

    I now realized that part. Search.php treats things differently, so I would need to set the language before the output construction. However I am still unaware on how to achieve this since I tried to use the head.inc language related code lines, and nothing resulted from that. Here's what I have:

    $lang = $user->language;
    $langname = $lang->name == 'default' ? 'pt' : $lang->name;
    

    I make no sense of this because I don't think it is setting anything (just storing the current languag in variables for further use), but everything else works. How can that be? I am confused now... ???

  8. Thanks for both answers. My content fields are all multilanguage and work perfectly with everything else.

    I implemented the changes Ryan pointed out and the error is gone. However, now the language resets always to the default one. I type the string, hit the button and the language changes back and displays results on that specific language.

    You can check it here: http://maran.pt/

    Try searching in portuguese (default) for "armario" and then, in english for "locker".

  9. Not technically a supported feature at present, but I think you can get the result you want. You'd take a query like this:

    $pages->find("body*=something");

    and convert it to this:

    $pages->find("body.data{$user->language}*=something"); 

    That should return just the pages that match the current user's language, rather than including the default language.

    Sorry to dig this up, but I've followed these instructions, changing:

    $matches = $pages->find("title|body|sidebar*=$q, limit=50, id!=1"); 

    to

    $matches = $pages->find("body.data{$user->language}*=$q, limit=50, id!=1"); 

    and the following error shows up:

    Error Exception: Unknown column 'field_body.data1029' in 'field list' (in /home/v3maran/public_html/wire/core/Database.php line 118)

    Any clue why this is happening? I am using the built in multilanguage module. Thank you.

  10. Just solved it. Was rather simple:

    if($area_alias){ $area_page_string = "catalog_product_area=$area_page,";}else{$area_page_string="";}
    if($tipo_name){ $type_page_string = "catalog_product_type=$type_page,";}else{$type_page_string="";}
    
    $matches = $pages->find("parent=/catalogo/produtos/,".$area_page_string.$type_page_string." limit=50, id!=1"); 

    Thanks!

    • Like 1
  11. Thanks to Ryan as well.

    I have another question though. If I have an URL like this:

    pesquisa-de-catalogo/?area=HL&type=passboxes

    and if I want to specify ANY area and leave the restraint only to the type, this returns zero results:

    pesquisa-de-catalogo/?area=&type=passboxes

    What's the better way to achieve that feature?

  12. Greetings,

    I wonder if anyone can help me understand how to overcome this issue. I am building a simples catalog with 3 taxonomy: category (determined by hierarchical page), type and area (both are selected using PageArray dropdowns, meaning that the Options are "pages" which have attributes themselves.

    Now, I want to create a search-like template that picks up the URL arguments, but I don't know how to set this correctly. I picked up the search.php example, and added category restriction, but now I want to also restrict by 'area'.

    $matches = $pages->find("title|body|sidebar*=$q, parent=/catalogo/produtos/, arealimit=50, id!=1");

    The area attribute has 4 items, all of them have title, description and a field called 'alias'. I would like to search by alias, and return all products that have that 'area' selected. The URL should look like this:

    domain.com/catalog-search/?q=carro&area=RH

    Now, I want to pickup the 'area alias' typed in the URL (which I already have), check to which 'area' this alias belongs, and use that area to filter my results. Since there can be multiple areas selected, how can that "search query" be built?

    Thank you very much for any help.

    • Like 1
×
×
  • Create New...