hi philip,
Have you experimented with LOAD and components?
>
>
never, i just ever learn from book and test it, never modified so far using
components.
i've already follow all your suggestion since it's still not work (no
errors occured) :
here is my update :
*
default.py (not worked with error)*
id=int(request.vars.id)
TypeError: int() argument must be a string or a number, not 'NoneType'
because in my previous version using callback the id is convert first into
int before process to session
def product():
* id=int(request.vars.id)*
* quantity=int(request.vars.quantity)*
form = SQLFORM.factory(Field('quantity', requires=IS_NOT_EMPTY()))
if form.process().accepted:
session.order[id]=session.order.get(id, 0)+quantity
rows=db((db.product.quantity>0) & (db.product.is_active == True)
& (db.product.category ==
category)).select(limitby=limitby,
orderby=~db.product.id,
cache=(cache.ram, 10))
return dict(rows=rows, form=form)
*default.py (not worked no error, just remove the int())*
def product():
id=request.vars.id
quantity=request.vars.quantity
form = SQLFORM.factory(Field('quantity', requires=IS_NOT_EMPTY()))
if form.process().accepted:
session.order[id]=session.order.get(id, 0)+quantity
rows=db((db.product.quantity>0) & (db.product.is_active == True)
& (db.product.category ==
category)).select(limitby=limitby,
orderby=~db.product.id,
cache=(cache.ram, 10))
return dict(rows=rows, form=form)
*product.html*
{{for i,row in enumerate(rows):}}
{{if i==items_per_page: break}}
<tr>
<td>{{=SPAN(row.product_name)}}
</td>
<td>{{=SPAN(T('Rp. '), row.unit_price)}}
</td>
<td>{{=SPAN(session.order.get(row.id,0), _id="item%s"%row.id),
T(' In Order')}}
</td>{{=form.custom.begin}}
<td>{{=form.custom.widget.source}}
</td>
<td>{{=form.custom.submit}}
</td>{{=form.custom.end}}
</tr>
{{pass}}
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.