Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi, I am trying to create this logic in cart_ex.php so that at checkout a buyer will have to choose a payment option from one of these 3 options - Cash, Money Money or Bank transfer. If the buyer chooses Mobile money payment a payment_charge of 1% of the subtotal/total should be added but if it's payment via cash or bank transfer it shouldn't be applied.

In my checkout.php file I did this:
Code: Select all
<cms:if "<cms:pp_count_items />" >
<cms:form anchor='0' method='post' id="checkout_form" class="checkout_form">

<cms:if k_success >
<cms:set_session name='selected_payment_option' value=frm_payment_options />

<cms:embed 'sales_email.html' />   
<cms:set_flash name='order_complete_msg' value="<cms:embed 'sales_success_msg.html' />"/>
<cms:pp_empty_cart />
<cms:redirect k_page_link />
</cms:if>


</cms:form>
<cms:input type="radio" name="payment_options"
   opt_values="Cash | Mobile Money | Bank Transfer"
   opt_selected = "<cms:get_session 'selected_shipping_location' />"
            />

<div class="button order_button"><a href="#"><input name="submit" type="submit" value="Place Order" /></a></div>
<cms:else />
     <div class="message">
    <p class="info">Your cart is empty!</p>
     </div>
</cms:if>
</cms:if>


In the cart_ex.php file i did this:
Code: Select all
function get_shipping(){
            global $KSESSION;

            $cost = 0;
            $items = $this->count_shippable_items;
            if( !$items ) return 0; // No item in the cart that needs shipping

//Check if cash or bank transfer is selected so you don't add charges
if($KSESSION->get_var('selected_payment_option') == 'Cash' || $KSESSION->get_var('selected_shipping_location') == 'Bank Transfer' ){
                    return 0;
            }


I used this https://www.couchcms.com/forum/viewtopic.php?f=4&t=7505&hilit=shipping+logic but each time I placed a test order the shipping charges still reflects in the invoice and total cost.

Another question is:
Will Item level shipping_charges cause the cart level shipping charges not to work? The reason for my question is that I sometimes apply shipping charges to certain quantities of some products although I have set a Cart level shipping charge inside the cart config.php
Did you succeed? Any updates for this topic?
Trendoman,
I was able to get the calculation to work. However, sometimes it doesn't work when I choose the Mobile money option in the drop down list
I see an input outside the form. Did you already corrected that?
4 posts Page 1 of 1
cron