Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi,

have been using the if statement a lot but seem to have reached a dead end with this one: want to create a drop down menu basket. The current code returns blank/ null. It does not say "basket is empty", but does display the information if quantity is present. when i do it with pp_total it displays he else statement if true. not sure what is happening i think it has something to do with the pp_cart_items function:

Code: Select all
<cms:pp_cart_items>
                                    <cms:if quantity >
                                       <div class="menu_cart_units quantity"><cms:show quantity /> x</div>
                                       <div class="menu_cart_option"><cms:show title /></div>
                                       <div class="menu_cart_subtotal">£<cms:number_format line_total /></div>
                                       <p class="menu_cart_total">Total: £ <cms:number_format "<cms:pp_total />"/></p>
                                    
                                 <cms:else />
                                     <p class="txt_fff f1 s14" >Basket is empty</p>
                                 </cms:if>
                                 </cms:pp_cart_items>


Thanks for your help
What does your 'quantity' variable contain then?
Code: Select all
<cms:concat 'My quantity is: ' quantity '.' />
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Hi,

it is the quantity from the shopping cart. it can be any variable from the shopping cart. Its just to check a value is in the cart be it pp_total or subtotal etc.

cms:concat havnt seen that before will look it up.

amazing what you can do with this system, still learning relations and functions

thanks for your help
Ok I have cleaned it up a bit, 2 problems:

1) Still does not display (basket is empty).
2) using quantity as an id to allow the ajax script from default couchcart to update the quantity works but it changes all items in cart to the total. seems i need to use cheesyproofs script? viewtopic.php?f=8&t=8602.

the total and the subtotal are updating and looks good.

Code: Select all
                           <li class="shoplist">                                       
                                 <cms:if pp_cart_items >
                                    <p class="txt_fff f1 s14" >Basket is empty</p>
                                       
                                 <cms:else />
                                 <cms:pp_cart_items>
                                     <div class="menu_cart_units "><span class="quantity"><cms:show quantity /></span>x </div>
                                       <div class="menu_cart_option"><cms:show title /></div>
                                       <div class="menu_cart_subtotal">£<cms:number_format line_total /></div>
                                       </cms:pp_cart_items>
                                 </cms:if>                                       
                                 
                                 <p class="menu_cart_total">Total: £ <spam class="price"><cms:number_format "<cms:pp_total />"/></span></p>
                           </li>
If your problem hasn't been resolve, maybe try this?

This code is in response to your basket is empty issue.

Code: Select all
<li class="shoplist">                                       
   <cms:if pp_cart_items >
      <cms:pp_cart_items>
         <div class="menu_cart_units "><span class="quantity"><cms:show quantity /></span>x </div>
         <div class="menu_cart_option"><cms:show title /></div>
         <div class="menu_cart_subtotal">£<cms:number_format line_total /></div>
      </cms:pp_cart_items>   
   <cms:else />
      <p class="txt_fff f1 s14" >Basket is empty</p>
   </cms:if>                                       
   
   <p class="menu_cart_total">Total: £ <spam class="price"><cms:number_format "<cms:pp_total />"/></span></p>
</li>
Hi John,

thanks for the reply. I take it that was to help fix the issue with "basket empty" not being displayed"?

That i manged to sort out, still can not get quantity and line total to update thoush. have tried to refresh just the dive or the span with :

Code: Select all
$(function() {
      $("#update_values").click(function() {
         $("#item_quantity").load("http://apecenergy.co.uk/products.php?p=4");
      })
    });


But does not refresh those fields, even though if you refresh the whole page it gets updated. and the cart already has the new values so im at a lost to what the problem is.
6 posts Page 1 of 1