Jump to content

Resolved] collection price and delivery price for each product


simonfguk

Recommended Posts

I am a novice and hope ive posted in the right category 

i would like to have products which show the prices  for delivery and collection and when you have added the products to your shopping cart, have the option for delivery price and collect price then pay accordingly

any help or pointers very much appreciated 

Link to comment
Share on other sites

Thank you for your reply

Ideally i would like something like this ( https://www.jjfoodservice.com/#search/meat speciality within meat ) which shows 2 prices delivery or collection and when you have  added say 15 products all with different prices ,you go to check out and before you pay have an option for delivery or collect and the cart total changes according to the option chosen, this would be fantastic Hope you can help, 

Regards Simon 

Link to comment
Share on other sites

Do the product pages show these prices as actual quoted shipping rates, or are they best average guesses. That is, do these shipping charges show for site visitors where the delivery address is not known?

Then, with 15 products in the cart, the total shipping charges do or do not add up from the individual estimated shipping charges?

In CubeCart, one can assemble several shipping charges calculated by differing means and present them to the customer to choose.

Showing a range of calculated shipping charges at checkout is a standard feature. Showing a range of calculated shipping charges on the product details page is interesting.

Link to comment
Share on other sites

I suppose its a cash and carry there is no shipping price as such just the product say eg flour 2.59 collection Del 2.89 they had there product to the cart were just before payment they get an option delivery if they pick this then its 2.89 if they pick collection then its 2.59 they might typically buy flour, chicken, beans, anything in a food cash and Carry.this is a better example that i would like to do http://www.afsfood.co.uk/category/322/KEBAB-HOUSE/tagged/NAAN-BREAD here you see the two prices delivery and collection the default is collection but just before payment they can pick delivery and the delivery price will be added up which is slightly higher once again thank you for taking the time to answer

If you add a couple of products from here http://www.afsfood.co.uk/category/324/BAKERY  then click cart total you will have a drop down box with options collect or home delivery the prices change according to which one you pick hope you can advise or help or know of any module that will do exactly this Once again thank you for taking the time to reply

Regards Simon

Link to comment
Share on other sites

We will start with installing these two shipping modules:

By-Percent: https://www.cubecart.com/extensions/shipping-methods/by-percent

Store-Collection: https://www.cubecart.com/extensions/shipping-methods/store-collection

By Percent adds a given percentage to the shopping cart's subtotal less any discounts that have been submitted. Also, a fixed handling charge can be added. We can edit the module's formula to calculate whatever we need: straight percentage, different percentage based on subtotal, whatever.

Store Collection simply adds that choice to the checkout shipping selector, but does not add any shipping charges.

The shipping charge choice will update the cart's Grand Total.

The next task, according to what I understand you want, is to show the base price of the product, as well as the solution from the formula used in the Percent module.

Link to comment
Share on other sites

In admin, Manage Extensions, click the Edit icon for Store Collection. Enable the Status, and name this Pickup. Save.

Then click the edit icon for By Percent. Enable the Status, and name this Delivery. Enter a number that the delivery charge represents. Use whole numbers, not fractions and no currency symbols. Enter a fixed handling charge if appropriate.

Also, in admin, Store Settings, Features tab, Misc. section, check the Disable Shipping Groups.

We are almost there. The one thing left is to make sure the product description page shows an estimated delivery charge. We can create an edit that will show an actual estimate, or we can say simply that there is a 15% delivery charge (regardless of the product's displayed price).

 

Link to comment
Share on other sites

There will be two edits (if using CC615). Keep a backup copy of the originals. If the backup copy of the javascript file is located in its original folder, it cannot keep its .js file suffix.

In the Foundation template content.product.php, near line 103, find:

         <h3>
            {if $PRODUCT.ctrl_sale}
            <span class="old_price" id="fbp"{if !$CTRL_HIDE_PRICES} data-price="{$PRODUCT.full_base_price}"{/if}>{$PRODUCT.price}</span>
            <span class="sale_price" id="ptp"{if !$CTRL_HIDE_PRICES} data-price="{$PRODUCT.price_to_pay}"{/if}>{$PRODUCT.sale_price}</span>
            {else}
            <span id="ptp"{if !$CTRL_HIDE_PRICES} data-price="{$PRODUCT.price_to_pay}"{/if}>{$PRODUCT.price}</span>
            {/if}
         </h3>

Change to:

            <h3>
               {if $PRODUCT.ctrl_sale}
               <span class="old_price" id="fbp"{if !$CTRL_HIDE_PRICES} data-price="{$PRODUCT.full_base_price}"{/if}>{$PRODUCT.price}</span>
               <span class="sale_price" id="ptp"{if !$CTRL_HIDE_PRICES} data-price="{$PRODUCT.price_to_pay}"{/if}>{$PRODUCT.sale_price}</span>
               <h6>Est. delivery charges: <span class="delivery_price" id="pwd"{if !$CTRL_HIDE_PRICES} data-price="{$PRODUCT.price_to_pay * 0.15}"{/if}>15%</span></h6>
               {else}
               <span id="ptp"{if !$CTRL_HIDE_PRICES} data-price="{$PRODUCT.price_to_pay}"{/if}>{$PRODUCT.price}</span>
               <h6>Est. delivery charges: <span id="pwd"{if !$CTRL_HIDE_PRICES} data-price="{$PRODUCT.price_to_pay * 0.15}"{/if}>15%</span></h5>
               {/if}
            </h3>
In the Foundation javascript file 2.cubecart.js, near line 370-430, delete that entire function.

In its place use the following:

function price_inc_options() {
    var action = $('form.add_to_basket').attr('action');
    var absolute = false;
    var total = 0;
    var ptp = parseFloat($('#ptp').attr("data-price"));
    var fbp = parseFloat($('#fbp').attr("data-price"));
    var pwd = parseFloat($('#pwd').attr("data-price"));
    var ptp_original = ptp;
    var fbp_original = fbp;
    var pwd_original = pwd;
    var parts = action.split("?");
    
    if (parts.length > 1) {
        action += "&";
    } else {
        action += "?";
    }

    $("[name^=productOptions]").each(function () {
        
        if($(this).is('input:radio') && $(this).is(':checked')) {
            if($(this).hasClass('absolute')) { total = ptp = 0; absolute = true; }
            total += parseFloat($(this).attr("data-price"));
        } else if ($(this).is('select') && $(this).val()) {
            if($("option:selected", this).hasClass('absolute')) { total = ptp = 0; absolute = true; }
            total += parseFloat($(this).find("option:selected").attr("data-price"));
        } else if (($(this).is('textarea') || $(this).is('input:text')) && $(this).val() !== '') {
            if($(this).hasClass('absolute')) { total = ptp = 0; absolute = true; }
            total += parseFloat($(this).attr("data-price"));
        }
    });

    var ptpt = (absolute ? total : ptp + total);
    action += '_g=ajax_price_format&price[ptp]=' + ptpt;
    if($('#fbp').length > 0) { var fbpt = fbp + total; action += '&price[fbp]='+ fbpt; }
    if($('#pwd').length > 0) { var pwdt = pwd + (total * 0.15); action += '&price[pwd]='+ pwdt; }

        $.ajax({
            url: action,
            cache: true,
            complete: function(returned) {
                var prices = $.parseJSON(returned.responseText);
                $('#ptp').html(prices.ptp);
                $('#fbp').html(prices.fpb);
                $('#pwd').html(prices.pwd);
                if (absolute && prices.ptp <= prices.fbp) {
                    $('#fbp').hide();
                    $('#ptp').removeClass('sale_price');
                } else {
                    $('#fbp').show();
                    $('#ptp').addClass('sale_price');
                }
            }
        });
}

Because we changed the javascript file, you will need to force your browser to reload the page resources.

The "Estimated Delivery Charges" are 'disconnected' from the shipping charges shown during checkout. That is to say, the By Percent module specifies 15%, and the edit to the skin specifies 15%, but these values, while they are the same, if changing one, that does not automatically change the other.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...