Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by dtbaker

  1. I've done this, it's a bit hard to explain because we've got a custom theme, but below is the php code and template code to get the "from" thing working. Quite a bit of code because it has to check if each attribute affects the price.

    In category.php this is what the code looked like "before":

    if ($category->id != 1)
               $nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
               $smarty->assign('nb_products', $nbProducts);
               $cat_products = $category->getProducts(intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay);

    and this is what it looks like "now":

    if ($category->id != 1)
               $nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
               $smarty->assign('nb_products', $nbProducts);
               $cat_products = $category->getProducts(intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay);
               foreach($cat_products as &$cat_product){
                   $cat_product['all_prices'] = array();
                   $product = new Product($cat_product['id_product'], true, intval($cookie->id_lang));
                   $cat_product['all_prices'][] = floatval($cat_product['price']);
                   $attributesGroups = $product->getAttributesGroups(intval($cookie->id_lang));
                   if (Db::getInstance()->numRows())
                       $combinationImages = $product->getCombinationImages(intval($cookie->id_lang));
                       foreach ($attributesGroups AS $k => $row){
                           $cat_product['all_prices'][] = floatval($cat_product['price']) + floatval($row['price']);
                   $diff_prices = array_unique($cat_product['all_prices']);
                   $cat_product['from_price'] = (count($diff_prices)>1) ? array_shift($diff_prices) : false;

    Then in themes/your_theme/product-list.tpl this is what it might have looked like before:

    {convertPrice price=$product.price}

    and this is what i changed it to.

    {if $product.from_price}from {convertPrice price=$product.from_price}{else}{convertPrice price=$product.price}{/if}



  2. hey guys, sorry about the inactivity. busy developing software.

    i found a bug in the aus post calcuator for people running in ONLY_WEIGHT mode.

    on about line 299 of shippingauspost.php file look for this:

    $final_quantity += $api_fields['Quantity'];

    delete this line all together, and you'll be sweet :)

  3. Hmmmmm.. you could *try* having the first carrier as "Australia Post", then a second carrier as "UK Post" (or whatever).

    No guarantees, have not tried this Aus Post module with more than 1 carrier, from memory it should only mess with the first installed carrier. So if your first installed carrier is setup to handle aussie customers, and the second one is setup for customers in UK, then it /might/ work.

    Let me know if it doesn't and i'll dig into the code again.

  4. For some reason when I have it set to ONLY_WEIGHT I can no longer add a product to my cart.

    Are you using the AJAX add to cart feature?
    Try turning this off so it goes back to oldschool add to cart, it should then show any error messages on the screen.

    Haven't tested this with ajax add to cart, but it should work the same.

    Got some free time late next week, hopefully do a little more cleanup/features on the code.
  5. Where do you make translations for Save all my products - and Product, price, weight etc.?

    at the moment there is only support for 1 language.
    if there is enough demand I can create a button that lets you switch between languages in future versions.
  6. Yes it's possible to change the "features" rather easily if you feel like messing with a bit of the code. No guarantees.

    Future versions will have a config section where you can choose which fields to edit, and possibly "page by page" listings for people who have more than a few hundred products.

    Will keep active/deactive flag in mind for when I next have a play with the code.


  7. Perhaps if we added the total weight of all the products in cart then calculated that postage with a quantity of 1, then we would derive the correct postage amount?

    :) it should do doing it like that now. hopefully.. :-/ ..
    ill be able to look at any more issues tomorrow, over and out
  8. The "Mass Update" spreadsheet style update plugin has been created, you are more than welcome to test it.


    Install instructions:
    * Go the PrestaShop Modules page
    * Click Add New Module
    * Copy & Paste this url: http://dtbaker.com.au/code/prestashop/massupdate.tar
    * Enter your admin password
    * Click "Install this module"
    * Click install again next to "Mass Update" (in the Products section)
    * Then click "Configure" to see the spreadsheet style product editor.

    Alternatively, there is a zip that you can unpack manually into the "modules" directory: http://dtbaker.com.au/code/prestashop/massupdate.zip

    Note: price bug has been fixed

    • Like 11
  9. Yes found a bug with the ONLY_WEIGHT mode.

    At the moment it is just adding all the weights together, and asking aus post for a price right at the end.
    This fails because of the 20kg limit.

    So, this needs to put products into groups of 20kg's (or less) and calculate shipping on each "group" of products?
    Then add all the shipping prices together at the end.

    If someone enters a single shopping cart item that weighs more than 20kg, what should happen? Throw an error saying Aus post cant handle 20kg?


  10. Hi everyone!

    The reason you were all getting FREE shipping is because of my simple little whoopsie in Cart.php :)

    I had a piece of code that made aus post work ONLY from my IP address, this is so I could test it on clients websites before making it go live. I forgot to remove this piece of code after doing the last round of updates! bugger.

    Anywho I have removed this silly piece of code, you can now update your classes/Cart.php with this file:
    or just remove the if($_SERVER['REMOTE_ADDRESS'] .... code on line 730, and the } on line 742

    Just tried this on a fresh prestashop install, and it gave me shipping prices back from Aus Post correctly.

    If someone has a working osCommerce setup, it would be great to get a comparison on shipping prices for similar products. It should be the same because they both get the prices from Aus Post, just gotta be sure.

    Let me know if you find any more bugs.


  11. Hey Sylvester,

    Yup you need 1 (and only 1 at the moment) carrier. You can name it whatever you like, Australia Post will do.
    (future versions will support multiple carriers)
    The aus post module simply overwrites all the settings for the configured carrier.

    Do you know how much it should be charging? and how much it differs from what gets calculated?

    Had a quick look at Aus Post website, it gave me $1.50'ish for posting a letter of that size, or $5'ish for express:

    You could try changing "Service_Type" to ECONOMY in the aus post config, not sure how that affects prices. Might do the trick tho.


  12. Due to the nature of our store, we need multiple products shipping to be calculated. I think the OsCommerce module I am using ignores the size and only uses the weight for calculation purposes, as we don't have sizes entered as attributes at the minute.

    Ok that's possible, I've added a new option.

    If you would like to try this out please re-install the Aus post module, to do so follow these steps:

    * Login to admin, go to modules
    * Click "uninstall" next to Australia Post
    * Click "Add new module"
    * Enter this url: http://dtbaker.com.au/code/prestashop/shippingauspost.tar
    * Enter your admin password
    * Click "install this module"
    * Now click "Install" again next to "Australia Post"
    * Click the ">>configure" link
    * You will see a few new settings
    * Change Calculate_Mode to ONLY_WEIGHT
    * This will calculate the final weight of an order, and work out the shipping price based on this.
    * You can also set default Weight, Width, Height, and Length for the products that don't have them individually set, could be handy if all your products are roughly the same dimensions.

    Lemme know if that give more osCommerce style results..

  13. I'm going to check out how eBay does it. Probably end up making a "packaging options" section in the module config.
    Ability to setup 5 or so shipping container sizes (satchel, box, or tube)
    That way if you have 50 small items, instead of calculating the individual shipping price of each item, we work out that all 50 items will fit into a box, and calculate the shipping price of that box.

    That sounds like a better way to do things.

  14. An update - It appears that my store now displays prices without tax, despite the option being set to not to display ex-tax prices on the product pages.

    Did this happen straight after installing the Aus Post module? Do these prices display incorrectly in the checkout process, or just the product page? The Aus Post code shouldn't mess with the individual product prices, just the overall shipping price.

    Also, when I entered multiple quantities, it charged me multiple shipping charges. Almost every order we take is a multiple purchase, often up to 100 products in a single order. The multiple shipping charges may be something I haven't set right in the features. I will investigate further and report back if I find the problem.

    Would you be able to send me the current process involved in calculating your shipping prices, I can see what I can do with the module.
  15. I've made a few adjustments to my previous post, it was late and I forgot to include a few minor things. =)
    * this will only work at the moment if you have a single Carrier (eg: Australia Post, as in the screenshot) you set this Carrier up like any old normal Carrier in Prestashop.
    * there is 1 more file to modify (order.php) so that the delay delivery gets displayed correctly.
    * to simplify things, I've just included the two modified files above, instead of instructions on how to modify them.

    If the user has 5 products in their shopping cart, it will go through and work out the Australia Post delivery cost for each individual product and then add them all together.
    If you need this to work differently (ie: adding the total widths, heights, lenghts, and/or weights before calculating the Aus Post price) please let me know.

  16. Instructions for setting up Australia Post shipping Calculator

    Note: these instructions are for PrestaShop version 1.1 final only
    Note: this really only works if you have a single Carrier listed, multi carrier support will come later
    Note: these instructions involve modifying a small amount of core PrestaShop code - only proceed if you know what you are doing, and keep in mind that these instructions will need to be followed again each time you upgrade PrestaShop (until PrestaShop provides a different way of setting this up)

    # Install the Australia Post module:
    ## Login as admin to PrestaShop and go to the Modules tab
    ## Click "Add a new module"
    ## Copy and Paste this url into the box: http://dtbaker.com.au/code/prestashop/shippingauspost.tar
    ## Enter your admin password
    ## Click "Install this module"
    ## (if you get errors here, i've probably moved the file, so hunt down my new blog)
    ## The module should install, and you should see it in the "Shipping" module block on that page.
    # Modify some PrestaShop code:
    ## This is the technical part. Make a backup of everything before continuing.
    ## There are two files you need to modify: order.php and classes/Cart.php
    ## To make it easier, I have linked these two files below
    ## Simply "Save As" these files over the top of your ones (make a backup of the old ones first!)
    ## http://dtbaker.com.au/code/prestashop/Cart_php.txt
    ## http://dtbaker.com.au/code/prestashop/order_php.txt
    ## Thats it! Your done, no more code modifications necessary!
    # Setting up the correct Width, Height, Length, and Weight for all your products
    ## Urgh - well it turns out Australia Post needs the Width, Height, Length, and Weight to give an accurate shipping price. So we need to add these to all the products.
    ## First go into "Catalog" and click the "Features" sub menu item up the top
    ## Make sure you have a Width, Height, and Length feature listed here, example:
    ## !http://dtbaker.com.au/code/prestashop/auspost3.jpg!
    ### Feature measurement units:
    #### You will notice I have "(cm)" written next to my features.
    #### You can have either "(cm)" or "(mm)" written here.
    #### "(mm)" is the default option if you don't specify anything here
    #### Make sure you enter all your widths, heights and lengths in the correct units, otherwise u'll get wrong prices
    #### The shipping calculator will automatically convert everything to "mm" before sending it to Aus Post for calculations.
    #### :)
    ## Note: if you want a quick way to update all your widths, heights, weights, and lengths from a single page (instead of going through each product one by one) please have a look at my Mass Update module (previous post), screenshot:
    ## !http://dtbaker.com.au/code/prestashop/mass_update.jpg!
    # Enabling the Australia Post module (YEY finally)
    ## Jump back to the modules screen in admin
    ## Scroll down until you see the Australia Post module:
    ## !http://dtbaker.com.au/code/prestashop/auspost1.jpg!
    ## Click the "Install" button, and then click the "> > Configure" button
    ## You will now see the Australia Post settings:
    ## !http://dtbaker.com.au/code/prestashop/auspost2.jpg!
    ## Here it is important to enter your post code, aka: the post office where you go to post items from.
    ## Feel free to increase/decrease the days or change the service type
    ## "STANDARD" is only what my customers use, so there's no option to change this during checkout, just yet :)
    ## Click "Save settings" and your done!!
    ## Do a few dummy orders and watch the Australia Post magic happen, yeww:
    ## !http://dtbaker.com.au/code/prestashop/auspost4.jpg!

    I'll post all this stuff up on my new blog, it's a few weeks away.
    Please let me know if you have any problems.

    Paypal donations =)
    https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]&item_name=PrestaShop-AusPost&currency_code=AUD

  17. Hi Katmatcreations,

    Would be awesome to get a second tester. The "Mass Update" excel style plugin is finished, you are more than welcome to test that out.


    Install instructions:
    * Go the PrestaShop Modules page
    * Click Add New Module
    * Copy & Paste this url: http://dtbaker.com.au/code/prestashop/massupdate.tar
    * Enter your admin password
    * Click "Install this module"
    * It should install with no probs
    * Click install again next to "Mass Update" (in the Products section)
    * Then click "Configure" to see the excel style product editor.

    Alternatively, there is a zip that you can unpack manually into the "modules" directory: http://dtbaker.com.au/code/prestashop/massupdate.zip

    Lemme know how it goes.

  18. Making another module that allows a "spreadsheet" style mass update of all your products.

    This will help my clients quickly enter the width, weight, length, and height of all their products.
    (these fields are required for Aus Post to calculate correctly)

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More