I changed the href to look like this: 
http://example.com/search/?itemperpage=15&{{
request.META.QUERY_STRING }}" and it still produces the same result.
Now when I click the link it looks like this:
http://example.com/search/?itemperpage=30&itemperpage=15&keywords=chai
(clicked 15 first, then 30)

-rt


On Jul 30, 9:24 am, RT <[email protected]> wrote:
> Thanks for the reply.  My context processors looks like this:
>
> TEMPLATE_CONTEXT_PROCESSORS =
> ('satchmo_store.shop.context_processors.settings',
>                                'django.core.context_processors.auth',
>
> #'satchmo_ext.recentlist.context_processors.recent_products',
>
> 'django.core.context_processors.request',
>                                )
>
> Here is the relative code from the template:
>
> <div class="item-per-page">
>         Items found: {{ products|length }}
>         <strong>Show: </strong>
>         <a href="?itemperpage=15&{{ request.META.QUERY_STRING }}"> 15
> </a>
> &rsaquo;&rsaquo;
>         <a href="?itemperpage=30&{{ request.META.QUERY_STRING }}"> 30
> </a>
> &rsaquo;&rsaquo;
>         <a href="?itemperpage=60&{{ request.META.QUERY_STRING }}"> 60
> </a>
> items per page.
>         <br class="clear-both" />
> </div>
>         {% autopaginate products request.session.itemperpage %}
>
> Here's what the middleware looks like:
>
> class PageMiddleware(object):
>     def process_request(self, request):
>         if not request.REQUEST.get('itemperpage', False):
>             if not request.session.get('itemperpage', False):
>                 request.session['itemperpage'] = 15
>         else:
>             try:
>                 request.session['itemperpage'] =
> int(request.REQUEST['itemperpage'])
>             except (KeyError, ValueError, TypeError):
>                 request.session['itemperpage'] = 15
>         return None
>
> I had to remove a line break from what you had posted above right
> after the try:
> its in a file called pagemiddleware.py within the pagination directory
> and I link to it in my settings like this:
>
> 'pagination.pagemiddleware.PageMiddleware',
>
> Thanks
> -RT
>
> On Jul 29, 1:16 pm, lzantal <[email protected]> wrote:
>
> > Hi,
>
> > That's weird. My template loads the same templatetags.
> > Are you using this in your link(case sensitive):
> > {{ request.META.QUERY_STRING }}
> > What is your TEMPLATE_CONTEXT_PROCESSORS has in it?
>
> > lzantal
>
> > On Jul 29, 12:56 pm, RT <[email protected]> wrote:
>
> > > It does it with both Django's development server and our production
> > > server which is CentOS with apache and mod_wsgi.  I checked it in
> > > firefox and chrome and both do the same thing.  I'm wondering, does
> > > {{ request.META.QUERY_STRING }} require the loading of more tags?
>
> > > Right now search.html loads:
> > > {% load i18n %}
> > > {% load thumbnail %}
> > > {% load satchmo_currency satchmo_discounts %}
> > > {% load pagination_tags %}
>
> > > Thanks for the help Izantal.  I have truly appreciated your many
> > > responses to my questions.
>
> > > -RT
>
> > > On Jul 29, 12:19 pm, lzantal <[email protected]> wrote:
>
> > > > Hi,
>
> > > > Hmm, I don't get that on my end...
> > > > Just tested it in prod server and on dev server.
> > > > Do you have "django.core.context_processors.request" in
> > > > TEMPLATE_CONTEXT_PROCESSORS ?
> > > > Just a thought. Could you try it with the django runserver ?
>
> > > > Thanks
>
> > > > lzantal
>
> > > > On Jul 29, 11:21 am, RT <[email protected]> wrote:
>
> > > > > Hey Izantal I noticed that if I switch multiple times something
> > > > > breaks.  I.e. if I click 30 then 15 then 60 the url gets constructed
> > > > > like this ?itemperpage=15&itemperpage=60&itemperpage=30 and it always
> > > > > displays the number of items for the first one I clicked (30 in this
> > > > > case).  How can I get around this?
>
> > > > > On Jul 29, 9:26 am, lzantal <[email protected]> wrote:
>
> > > > > > no problem :)
>
> > > > > > lzantal
>
> > > > > > On Jul 29, 9:20 am, RT <[email protected]> wrote:
>
> > > > > > > thanks izantal!
>
> > > > > > > -rt
>
> > > > > > > On Jul 27, 6:32 pm, lzantal <[email protected]> wrote:
>
> > > > > > > > Hi,
>
> > > > > > > > Here is the code to let the user choose the amount of products
> > > > > > > > displayed per page.
> > > > > > > > I created a pagemiddleware.py module and added it to the
> > > > > > > > MIDDLEWARE_CLASSES in settings.py
> > > > > > > > I have this very simple class in pagemiddleware.py
> > > > > > > > """
> > > > > > > > class PageMiddleware(object):
> > > > > > > >     def process_request(self, request):
> > > > > > > >         if not request.REQUEST.get('itemperpage', False):
> > > > > > > >             if not request.session.get('itemperpage', False):
> > > > > > > >                 request.session['itemperpage'] = 15
> > > > > > > >         else:
> > > > > > > >             try:
> > > > > > > >                 request.session['itemperpage'] =
> > > > > > > > int(request.REQUEST['itemperpage'])
> > > > > > > >             except (KeyError, ValueError, TypeError):
> > > > > > > >                 request.session['itemperpage'] = 15
> > > > > > > >         return None
> > > > > > > > """
>
> > > > > > > > After this change the search.html template
> > > > > > > > """
> > > > > > > > {% with results.products as products %}
> > > > > > > > <div class="item-per-page">
> > > > > > > >         Items found: {{ products|length }}
> > > > > > > >         <strong>Show: </strong>
> > > > > > > >         <a href="?itemperpage=15&{{ request.META.QUERY_STRING 
> > > > > > > > }}"> 15 </a>
> > > > > > > > &rsaquo;&rsaquo;
> > > > > > > >         <a href="?itemperpage=30&{{ request.META.QUERY_STRING 
> > > > > > > > }}"> 30 </a>
> > > > > > > > &rsaquo;&rsaquo;
> > > > > > > >         <a href="?itemperpage=60&{{ request.META.QUERY_STRING 
> > > > > > > > }}"> 60 </a>
> > > > > > > > items per page.
> > > > > > > >         <br class="clear-both" />
> > > > > > > > </div>
> > > > > > > >         {% autopaginate products request.session.itemperpage %}
> > > > > > > >                 <ul>
> > > > > > > >                 {% for product in products %}
> > > > > > > >                 / more code here /
> > > > > > > >                 {% endfor %}
> > > > > > > >                 </ul>
> > > > > > > >                 <br />
> > > > > > > >     {% paginate %}
> > > > > > > > {% endwith %}
> > > > > > > > """
>
> > > > > > > > I put the middleware into the pagination app.
>
> > > > > > > > lzantal
>
> > > > > > > > On Jul 27, 1:12 pm, RT <[email protected]> wrote:
>
> > > > > > > > > That sounds really useful, I'll look forward to it!
>
> > > > > > > > > On Jul 27, 12:38 pm, lzantal <[email protected]> wrote:
>
> > > > > > > > > > Hi,
>
> > > > > > > > > > Glad to hear that.:)
> > > > > > > > > > I'll be home tonight and will add the code that let the 
> > > > > > > > > > user set
> > > > > > > > > > quantity/page,
> > > > > > > > > > It also displays the Items Found.
>
> > > > > > > > > > lzantal
>
> > > > > > > > > > On Jul 27, 9:48 am, RT <[email protected]> wrote:
>
> > > > > > > > > > > Thanks Izantal, that works great!
>
> > > > > > > > > > > -RT
>
> > > > > > > > > > > On Jul 26, 9:48 pm, lzantal <[email protected]> wrote:
>
> > > > > > > > > > > > Hi,
>
> > > > > > > > > > > > On Jul 26, 10:01 am, RT <[email protected]> wrote:
>
> > > > > > > > > > > > > I know this has been discussed before but it seems 
> > > > > > > > > > > > > like it has been
> > > > > > > > > > > > > awhile.  What is the status of pagination (say of 
> > > > > > > > > > > > > search) in Satchmo.
> > > > > > > > > > > > > Is it easy functionality to attain?
>
> > > > > > > > > > > > Yes it is. I'll dig up the code tomorrow to let the 
> > > > > > > > > > > > user select how
> > > > > > > > > > > > many product they want to display on the page Eg: Show 
> > > > > > > > > > > > 15, 30, 60.
> > > > > > > > > > > > I am using the pagination app  
> > > > > > > > > > > > http://code.google.com/p/django-pagination/
> > > > > > > > > > > > .
> > > > > > > > > > > > Once you install it here is the pagination specific 
> > > > > > > > > > > > code from my shop/
> > > > > > > > > > > > search.html template
> > > > > > > > > > > > """
> > > > > > > > > > > > {% load pagination_tags %}
> > > > > > > > > > > > {% with results.products as products %}
> > > > > > > > > > > > {% autopaginate products %}
> > > > > > > > > > > >                 <ul>
> > > > > > > > > > > >                 {% for product in products %}
> > > > > > > > > > > >                 / more code here /
> > > > > > > > > > > >                 {% endfor %}
> > > > > > > > > > > >                 </ul>
> > > > > > > > > > > >                 <br />
> > > > > > > > > > > >     {% paginate %}
> > > > > > > > > > > > {% endwith %}
>
> > > > > > > > > > > > Hope it helps
>
> > > > > > > > > > > > lzantal
>
> > > > > > > > > > > > > -RT

-- 
You received this message because you are subscribed to the Google Groups 
"Satchmo users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/satchmo-users?hl=en.

Reply via email to