Report bugs for version 1.2.8 here

Enter AlegroCart Bugs Here, but if you're not certain, post in General support first.
User avatar
Brent
Site Admin
Posts: 4459
Joined: Sat Dec 12, 2009 3:35 pm
Location: Canada eh

Re: Report bugs for version 1.2.8 here

Post by Brent » Sun Oct 27, 2013 8:16 am

If I remember correctly, this was part of the implemtation to facilitate methods that have multiple choices for shipping.
If you look at the Canada post and Autrailian post shipping modules, you will find good examples.
In both cases, because they return more than one choice, the return data must be parsed to separate the choices of shipping. Because this is processer intensive, we only want to do this once.
If the method, for example, Canada post is selected, and the items in the cart have not changed since the last shipping quote, it is not required to get the quote again as nothing will have changed. This saves server overhead and reduces page load time when the is no changes required on the multiple quotes.

gob33
Posts: 107
Joined: Wed Apr 07, 2010 3:10 pm

Re: Report bugs for version 1.2.8 here

Post by gob33 » Mon Oct 28, 2013 9:59 am

The shipping calculus is always done anyway in the controller by a getQuotes() so memorization is useless.
The real problem here is the added code is buggy, outside of 'error' case, $default is correctly tested after.
See image: in red what had been wrongly added.
Snap7.gif
Snap7.gif (33.78 KiB) Viewed 21270 times
NB: Restriction to 900px wide on image upload is too narrow.

User avatar
Brent
Site Admin
Posts: 4459
Joined: Sat Dec 12, 2009 3:35 pm
Location: Canada eh

Re: Report bugs for version 1.2.8 here

Post by Brent » Tue Oct 29, 2013 4:36 pm

I am not sure I know what your point is. This is not 7.7.
There have been many things changed and added since those days. All that code is required.
If you consult the demo, it has shipping methods the return mutiple quotes. The code you are referring to is to enable this process and differentiat the chosen quote.
As I said in the previous post, consult one of the examples like Canada Post or Austrailian post. They both work fine with the above code.

gob33
Posts: 107
Joined: Wed Apr 07, 2010 3:10 pm

Re: Report bugs for version 1.2.8 here

Post by gob33 » Wed Oct 30, 2013 9:38 am

I use OC 0.7.7 for reference as i dont know when you forked. It helps me to see what had been added since.
AustPost doesnt manage errors when querying server. CanadaPost adds an empty array on quote error whereas i do not add an empty array when in error because i return differents quotes per shipping method. By that way CanadaPost passes the if() line 66.

Note there is only one 'error' key at method level in other ecommerce softwares, but in Alegro also an 'error' key at quote level which is used like a copy.

My purpose is only to make portability of modules easier and faster for developpers by dealing with an identical structure and not to copy OpenCart. For the moment, the above code harms portability.
Snap8.gif
Snap8.gif (20.04 KiB) Viewed 21262 times

User avatar
Brent
Site Admin
Posts: 4459
Joined: Sat Dec 12, 2009 3:35 pm
Location: Canada eh

Re: Report bugs for version 1.2.8 here

Post by Brent » Wed Oct 30, 2013 1:49 pm

This is the shipping with error.
Australia post does not handle errors well and does not support multiple shipping quotes whereas Canada post does.
Canada post only returns applicable quotes or returns an error, not both.
Shipping example.jpg
Shipping example.jpg (184.15 KiB) Viewed 21258 times

gob33
Posts: 107
Joined: Wed Apr 07, 2010 3:10 pm

Re: Report bugs for version 1.2.8 here

Post by gob33 » Fri Nov 01, 2013 9:14 am

A solution is to replace line 66+ with JQuery code at bottom of page which colorize border's default shipping box in blue.
Then the file do not break with shipping extensions ported from OC.

checkout_shipping.tpl:

Code: Select all

      <table class="method">
      <tbody>
        <tr>
          <td class="g" colspan="2"><b><?php echo $method['title']; ?></b></td>
        </tr>
      <?php if (!$method['error']) { ?>
        <?php foreach ($method['quote'] as $quote) { ?>
          <?php if (isset($quote['error']) && !empty($quote['error'])) { ?>
            <tr>
              <td class="g" colspan="2"><div class="warning"><?php echo $quote['error']; ?></div></td>
            </tr>
          <?php } else { ?>

            <tr>
              <td class="g"><label for="<?php echo $quote['id']; ?>">
                <?php if ($quote['id'] == $default) { ?>
                <input type="radio" name="shipping" value="<?php echo $quote['id']; ?>" id="<?php echo $quote['id']; ?>" checked="checked" />
                <?php } else { ?>
                <input type="radio" name="shipping" value="<?php echo $quote['id']; ?>" id="<?php echo $quote['id']; ?>" />
                <?php } ?>
                <?php echo $quote['title']; ?></label></td>
              <td class="i"><label for="<?php echo $quote['id']; ?>"><?php echo $quote['text']; ?></label></td>
              <input type="hidden" name="<?php echo $quote['id']; ?>_quote" value="<?php echo $quote['text']; ?>">
            </tr>
            <?php if (isset($quote['shipping_form'])) { echo $quote['shipping_form']; } ?>

          <?php } ?>
        <?php } ?>

      <?php } else { ?>
        <tr>
          <td colspan="2" class="g"><div class="warning"><?php echo $method['error']; ?></div></td>
        </tr>
      <?php } ?>
      </tbody>
      </table>

Code: Select all

<script type="text/javascript">
$('input[name="shipping"][checked="checked"]').closest('table').attr('class', 'default_method');
</script>

User avatar
leo
admin
Posts: 4320
Joined: Sun Dec 13, 2009 8:27 am
Location: Hungary

Re: Report bugs for version 1.2.8 here

Post by leo » Mon Nov 04, 2013 7:22 am

I am working on modifying the checkout process. This is on the todo list.

gob33
Posts: 107
Joined: Wed Apr 07, 2010 3:10 pm

Re: Report bugs for version 1.2.8 here

Post by gob33 » Mon Nov 04, 2013 10:15 am

Ok, i finished porting my shipping extension. It runs normally with the change upper.

Note: There is in the currency class, a "convert($from, $to)" method which calls an outside server to get latest quotes.
If it is fine when you are connected permanently to internet, it fails when you are not and returns 0.
For testing in local, a simple method doing a division with stored values would be better.
I was unable to find one and must copied the OC method.

User avatar
Brent
Site Admin
Posts: 4459
Joined: Sat Dec 12, 2009 3:35 pm
Location: Canada eh

Re: Report bugs for version 1.2.8 here

Post by Brent » Mon Nov 04, 2013 4:45 pm

If you open up each currency you have enabled, there is a thing called lock rate. Enable it.
You then insert whatever you want for an exchange rate and it will never be updated. That will be the rate for that currency.
This was implemented both for offline as well as special cases when mechants want a constant rate of exchange with specific trading partners.

rama_gatez
Posts: 2
Joined: Mon May 04, 2015 6:49 am

Re: Report bugs for version 1.2.8 here

Post by rama_gatez » Mon May 11, 2015 5:37 pm

i have problem with this, what shoul i do to fix this in :

C:\xampp\htdocs\Alegrocart\upload\library\database\database.php on line 23

Coding:
function connect($server, $username, $password, $database) {
if (!$this->connection = mysql_connect($server, $username, $password)) { ->line 23
$this->SQL_handler(sprintf(E_DB_CONN,$username,$server));
exit;
}



i hope you can help me to solve this problem
because i have assignment in my campus

Locked