All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Segment variable parsing problem!

QuốcHưngLê 16 Dec 2012 16:47 problem, rejected

Hi Low

I was successfully integrated Low Reorder with InfiniteScroll via this tut of Justin Long and recently due to some changes in the URL structure, I can't get it to work like normal.

+ My URL structure used to look like this: mydomain.com/parent_cat/category/child_cat

and each parent_cat and child_cat has its own Low Reorder Set with the Set's short_name exactly the same with its short_name. For example a category Cameras ( cameras ) will have set Cameras ( with short name as cameras ). The reason is I want to pass the set name to Low Reorder from the URL.

I used 2 templates which is parent_cat/index and prent_cat/category so display the entries respectively. So in the past, I have only 2 cases are the parent_cat and the child_cat which means the variable that I need to pass to Low Reorder would be {segment_1} and {segment_3} respectively. And everything was working very well.

However, I now use only 1 template to handle all the categories. cat/index.
My URL structure now looks like this: mydomain.com/cat/cat1/cat2.
The idea is the same but things will only works if I pass {segment_1}, {segment_2} or {segment_3} but not {last_segment}.

If I used {last_segment}, Low Reorder will only display the 1st batch of entries ( the limit number ) and will not display the next batches via Infinite Scroll.

I'm not aware of any differences between {segment_x} and {last_segment}, neither their parse order..

I tried to use conditionals and many other ways but still no luck finding the bug.
I'm very confused and will be happy to provide all the necessary credentials that you need in order to fix this.

Thanks!

Replies

  1. Low 17 Dec 2012 08:00

    What does the Low Reorder Entries tag look like? Also, if you turn on template debugging, look up the lines that start with Low Reorder, as well as the parsed opening tag. What does that tell you?

  2. QuốcHưngLê 17 Dec 2012 09:22

    Hi Low

    Thank you for getting back to me.

    I put Low Reorder Entries Tag in a snippet called {sp_product_category_index} and it looks like this:

     
    {exp:low_reorder:entries set="{pre_products_set}"
    disable="categories|category_fields|member_data"
    cache="yes"
    limit="12"
    refresh="360"
    dynamic="yes"}
    <li>
    Entries' content....
    <li>

    {paginate}
    <div class="navigation">
    {if next_page}
    <a class="next js_hide_next" href="{auto_path}">
    Next Page
    </a>
    {/if}
    </div>
    {/paginate}

    {/exp:low_reorder:entries}


    In the main template, I pass the set' short name to this snippet by this:
     
    {preload_replace:pre_products_set="{last_segment}"}
    {sp_product_category_index}


    Here is what I found in the template debugger's logs:

    (3.344333 / 10.60MB) Low Reorder: Retrieving set from database
    (3.358743 / 10.64MB) Low Reorder: Getting ordered entry_ids from database
    (3.365519 / 10.66MB) Low Reorder: Setting parameters status="open" category="498" channel="products" fixed_order="4715|4650|4624|4718|4720|4635|4643|4641|4642|4654|4655|4649|4644|4648|4719|4645|4647|4640|4721|4627|4626|4628|4629|4630|4631|4632|4633|4722|4724|4717|4634|4625|4653|4652|4651|4623|4636|4638|4637|4639|4646|4760|4761|4762|4755|4820|4691|4757|4689|4675|4690|4688|4753|4685|4687|4686|4754|4684|4695|4692|4751|4693|4750|4694|4696|4752|4779|4775|4781|4774|4778|4777|4771|4780|4783|4772|4782|4776|4773|4798|4744|4745|4743|4742|4748|4749|4746|4747"
    (3.365546 / 10.66MB) Low Reorder: Calling the channel module

    Thanks!

  3. Low 17 Dec 2012 09:28

    By the looks of that, Low Reorder is finding the ordered set and is calling the channel:entries tag after setting the the correct parameters. Everything's working from that end.

    The problem might be with the JS getting the rest of the entries. Are you sure everything is correct there?

  4. QuốcHưngLê 17 Dec 2012 09:33

    Hi Low

    I'm not saying that Low Reorder is not working. It does get the right variable and pull the entries, the thing is it just doesn't pull all of them.

    What makes me confused is that I just don't understand why changing from {last_segment} to {segment_x} then everything would work as expected without editing any thing from the js file.

    I just copied and pasted from my templates so I'm certain that everything is correct.
    Thanks!

  5. Low 17 Dec 2012 09:42

    And by "all of them" you mean getting the next page of entries via Ajax, right?

    Can you see what URL is being called by the Ajax request?

  6. QuốcHưngLê 17 Dec 2012 09:57

    Yes, that's what I meant.

    The URL doesn't change when the Ajax calls.
    It would be smt like:

    mydomain.com/cat1 OR
    mydomain.com/cat1/cat2 OR
    mydomain.com/cat1/cat2/cat3

    Thanks!

  7. Low 17 Dec 2012 10:02

    Okay, send me superadmin login credentials to hi at gotolow dot com and I'll take a look. But please know that this looks like non-LR issue, so officially falls outside of the scope of my support.

  8. QuốcHưngLê 17 Dec 2012 10:07

    I just sent!
    Thanks for looking into it!

  9. Low 17 Dec 2012 10:20

    Actually, the URLs that are triggered for the infinite scroll look something like this:

    mydomain.com/group/cat1/P12

    Now, look at that URL and see what the {last_segment} is. That'll be 'P12', not 'cat1', so the right set is not found. And that's why it does work with the {segment_x} vars.

    You might want to take a look at Mo' Variables: http://devot-ee.com/add-ons/mo-variables
    ...and using the {if paginated} conditional and reverse segment vars.

  10. QuốcHưngLê 17 Dec 2012 10:36

    Ahhh....

    I understand now!
    Thanks a lot for your direction. I will try your solution and see what happens!
    Cheers!

  11. QuốcHưngLê 17 Dec 2012 15:23

    Update: Your solution works for me like a charm.
    These first 3 lines fix my problem.


    {if paginated}
    {preload_replace:pre_products_set="{rev_segment_2}"}
    {/if}
    {preload_replace:pre_products_set="{last_segment}"}
    {sp_product_category_index}


    Thank you, Low.
    I really appreciate your help!
    Cheers!

  12. Low 17 Dec 2012 15:24

    Cool, glad you got it working.

  13. QuốcHưngLê 17 Dec 2012 15:27

    Yup!
    Thanks to you!
    Cheers!