If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Admin Tools / zen Return Manager (Support thread)

zen Return Manager (Support thread)

Started by davewest on 13 Nov 2017, 8:07 PM · Views: 4,474

Results 1 to 20 of 26
13 Nov 2017, 8:07 PM
#1
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Post #1 by davewest

I was still thinking of some other things to add, but the database table is finished changing for now.

Actually, I've been using it live for some time before packaging it up and sending it out. There are so many different ideas on returns and cancels that its near impossible to make something that works on everything right out of the box.

This started out as another return module update. The user side was easy and created with Check-Out-With-Any-Account in mind so it never required log in. The admin side was a tag-along to the orders page which lacked the ability to do anything useful with a return. If you have Edit Order or Supper Orders installed you already have the ability to edit orders and do refunds, but you still not able to track or figure out whats what with returns and no one is thinking about cancels... I was amazed at how one super store did cancels and not just returns which is why cancels was added.

Return manager has basically three functions:
Any one item or all in a order can be..

  1. Cancel if the order status is still in processing. (I loved how Ama2on did this one)
  2. Return any item that the status is above processing and within the stores return policy days. (auto RMA number is sent and posted)
  3. admin can cancel/set return status on any item in the order right from admin without pretending to be the customer!

At each of the three emails are sent to customer and store manager.

The order is not erased or modified by return manager. There are other good mods that can do this for you. I wanted something to track, maintain documentation of the return process. I did some coding so you have a calculator to figure out what the return dollars could be and so on... then a note is added to the order status comments so on the order page side you can do the return and not have to figure out the dollar amounts. Returns and cancels are maintained in there own table.

There are some edits to the user account order history and admin order page. The user account page is not necessary, the admin side is to aid admin in creating returns/cancels for a order and adds a button taking the order to return manager.

Install is as simple as I could think of... upload files, edit the two core files, access admin. Uninstall is a button click, remove added files, upload your backup of the two edited files.

If you have testimony manager installed, the button to add will show on the order status page. Buttons for reviews are displayed under each product. Based on the responsive default template of ZC155e, however its not limited to its javascript. The design is responsive without scripting and could be used on any template with some work.

I've not tested below ZC155e and php7.1..

Well be submitted shortly wanted to get this linked in the documents.

Dave
Always forward thinking... Lost my mind!

27 Nov 2017, 2:13 PM
#2
naczyls747 avatar

naczyls747

New Zenner

Join Date:
Feb 2014
Location:
Malaysia
Posts:
24
Plugin Contributions:
0

Post #2 by naczyls747

Thank you so much for creating this plugin.

I've installed it on 1.5.5e,

  1. the admin side
  • unable to save the order after inputting data for restocking fees and shipping charges
  1. live shop (test site)
  • when users are required to login, the plugin doesn't display properly. Keep asking for login (even when I did). But when I removed the requirement to login, it shows properly
  • at landing page - there's some typo (copied and pasted from site; which of course we can edit by ourselves): "Leave us feedback by writing reviews or testimoalys!"
  • not sure which css code in stylesheet_order_status file breaks my left column.. causes disalignment (but I will try to work on this)

Sorry.. I am a newbie in all these stuffs. Just listing the problems that I faced >_<
But thank you so much for the plugin!

P/s: A suggestion, can we choose to not allow cancellation? Only returns? :)

28 Nov 2017, 9:10 PM
#3
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Post #3 by davewest

naczyls747:

  1. the admin side
  • unable to save the order after inputting data for restocking fees and shipping charges
    Not sure what you are asking here! Orders are not modified by returns. Total estimated refunds are saved and posted to order comments. What was entered in the calculator is not saved. Would saving both calculator and totals than reposting next time the same return was open help?
  • when users are required to login, the plugin doesn't display properly. Keep asking for login (even when I did). But when I removed the requirement to login, it shows properly
    Fixed. v1.0.1 -- This was not finished as it should of been. Now it responds as other login require pages and redirects to the login page. Login box removed from Order Status page, duplicate.
  • at landing page - there's some typo (copied and pasted from site; which of course we can edit by ourselves): "Leave us feedback by writing reviews or testimoalys!"
    Fixed. v1.0.1 -- This was left over quick text that never was moved to language defines where spell-check occurs. Defines updated, language updated to match current code changes.
  • not sure which css code in stylesheet_order_status file breaks my left column.. causes disalignment (but I will try to work on this)
    Fixed. v1.0.1 -- This was a missed placed closing DIV tag on the Order Table section. Removed.

P/s: A suggestion, can we choose to not allow cancellation? Only returns? :)
Added. v1.0.1 -- Added switch in return configure to turn off cancels.

I have some more clean-up to do before sending the updated version in..

Dave
Always forward thinking... Lost my mind!

29 Nov 2017, 1:59 AM
#4
naczyls747 avatar

naczyls747

New Zenner

Join Date:
Feb 2014
Location:
Malaysia
Posts:
24
Plugin Contributions:
0

Post #4 by naczyls747

Wow, thank you again for the immediate response! :)))

davewest:

Not sure what you are asking here! Orders are not modified by returns. Total estimated refunds are saved and posted to order comments. What was entered in the calculator is not saved. Would saving both calculator and totals than reposting next time the same return was open help?

When I tried to "create return" from admin panel (under orders list),

  • it doesn't save the data I input under "Edit Totals". It will auto calculate the data, but would not update when I clicked on "save". Now that I think about it, are these inputs meant to be edited or it will just auto fill up? If it's the latter, could you please include how can we set up the required fields data?
  • the return address in red - shows all the correct figure (in red), after clicking "update" nothing happens..
29 Nov 2017, 4:33 AM
#5
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Post #5 by davewest

naczyls747:

Wow, thank you again for the immediate response! :)))

When I tried to "create return" from admin panel (under orders list),

  • it doesn't save the data I input under "Edit Totals". It will auto calculate the data, but would not update when I clicked on "save". Now that I think about it, are these inputs meant to be edited or it will just auto fill up? If it's the latter, could you please include how can we set up the required fields data?
  • the return address in red - shows all the correct figure (in red), after clicking "update" nothing happens..

This one is a bit different in that the quantity field is what removes or creates the return/cancel. If its quantity is zero, the return/cancel is deleted, grater then zero, the return/cancel is created. The code will not allow quantity grater then ordered. This field needs to be updated before address or return totals can be edited or saved. Return/cancels are based on items and not just the full order.

The button in the order page just takes you to the return page where once there you can tell it how many items and which ones to include in this return/cancel. Once that is done and the update button is hit, the rest of the info can be displayed and edited.

I'll look at modifying how the buttons are displayed so to make it easer to lead a user in the right direction.

Dave
Always forward thinking... Lost my mind!

29 Nov 2017, 6:52 AM
#6
naczyls747 avatar

naczyls747

New Zenner

Join Date:
Feb 2014
Location:
Malaysia
Posts:
24
Plugin Contributions:
0

Post #6 by naczyls747

Hi, I am not too sure if I am doing it correctly on the admin panel.

I edit a few data in "edit totals" field and saved it, but it returns with original data >_<

Attachment 17497

3 Dec 2017, 6:55 PM
#7
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Post #7 by davewest

naczyls747:

Hi, I am not too sure if I am doing it correctly on the admin panel.

I edit a few data in "edit totals" field and saved it, but it returns with original data >_<

Just sent in an update for review.

The update turns off buttons that are not yet available until you create the return/cancel.

  • Fixed. v1.0.1 -- Now it responds as other login require pages and redirects to the login page. Login box removed from Order Status page, duplicate.
  • Fixed. v1.0.1 -- Removed quick text that never was moved to language defines where spell-check occurs. Defines updated, language updated to match current code changes.
  • Fixed. v1.0.1 -- Removed missed placed closing DIV tag on the Order Table section.
  • Fixed. v1.0.1 -- Save totals now saves all edited and estimated total to the database for retrieval next time the return is viewed or edited. Minimum in pack to the existing data table by use of an array instead of individual fields.
  • New. v1.0.1 -- Added switch in return configure to turn off cancels.
  • New. v1.0.1 -- Add the ability to send update or new email to customer and admin from the Return Manager page!

Updated my website and gethub pages with the new version.

Dave
Always forward thinking... Lost my mind!

31 Jan 2018, 5:59 AM
#8
tmccaff avatar

tmccaff

Zen Follower

Join Date:
Jan 2018
Posts:
157
Plugin Contributions:
0

Post #8 by tmccaff

Not displaying total correct when you use sidebox order tracking. The 0.7 is the tax. Now I am using one_page_checkout maybe that is the problem.

31 Jan 2018, 3:58 PM
#9
tmccaff avatar

tmccaff

Zen Follower

Join Date:
Jan 2018
Posts:
157
Plugin Contributions:
0

Post #9 by tmccaff

I tested it with one page checkout off and still not displaying order total correctly. I will see if I can fix it.

31 Jan 2018, 5:18 PM
#10
tmccaff avatar

tmccaff

Zen Follower

Join Date:
Jan 2018
Posts:
157
Plugin Contributions:
0

Post #10 by tmccaff

If I change this line in tpl_order_status_default.php

  <?php $i=2; ?>
<h2><?php echo TEXT_ORDER_SUB_TOTAL . $order->totals[0]['text'] . '<br />' . TEXT_TOTAL . $order->totals[2]['text']; ?></h2>
</div></div>

to the following it works but not sure if correct.

<?php
  for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) {
?>
<h2><?php echo $order->totals[$i]['title'] . '<br />' . $order->totals[$i]['text']; ?></h2>
<?php
  }
?>
</div></div>
31 Jan 2018, 9:06 PM
#11
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Post #11 by davewest

Good catch... a section I didn't go back and fixed correctly.

The intent was to just show the total of the order and not the sub totals, tax and so on.
your fix would show everything.
If you wish to just show the full total of the order, then this would work.

Replace this:

  <?php $i=2; ?>
<h2><?php echo TEXT_ORDER_SUB_TOTAL .  $order->totals[0]['text'] . '<br />' . TEXT_TOTAL .  $order->totals[2]['text']; ?></h2>

With the following:

<?php 
$keys = array_keys($order->totals);
$lastKey = $keys[count($keys)-1]; 
?> 
<h1><?php echo 'Order ' . $order->totals[$lastKey]['title'] . ' ' .  $order->totals[$lastKey]['text']; ?></h1> 
<br class="clearBoth" />

To explain a bit, the array $order->totals changes in size according to the order if shipping, tax and so on was applied or not. The last line is the total of this order and that is the one we need. All we need is that last number or key

[$lastKey] => Array ( [title] => Total: [text] => $30.40 [class] => ot_total [value] => 30.4000 )

Dave
Always forward thinking... Lost my mind!

31 Jan 2018, 9:45 PM
#12
tmccaff avatar

tmccaff

Zen Follower

Join Date:
Jan 2018
Posts:
157
Plugin Contributions:
0

Post #12 by tmccaff

Thanks so much; that worked. Got you so Key [1] would be subtotal, key [2] I am guessing tax, key [3] would be shipping and [4] would be total that's if tax was applied of course. I think I am getting it.

31 Jan 2018, 10:02 PM
#13
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #13 by mc12345678

Haven't done what may be considered the proper "homework" to offer a complete code revision, but can see where the above suggested use of the last order total may not provide the truly intended result. It appears that the intended result is what is provided by the ot_total module, regardless of its sort order (position in the list).

To explain my thought process on that: the described goal of the output is to provide the result of the ot_total order total module, regardless of its sort order. Certainly as the software is open source one may change the internal assignment of $this->code = 'ot_total' to something else, but the position of the module ot_total is not required to be the last in the list of order totals. (consider a module that gives the customer some sort of points, store credit, or other "reward" based on the total purchase whether that total includes taxes, shipping or other costs or not.) Therefore, that other module (and/or any others that depend on it) may be last in the list instead of the ot_total module. It seems instead of using the last order total module that instead, if the ot_total module is used (which it is also possible that it is disabled) that the ot_total's "result" be presented or if not enabled, then perhaps some other "related" information (order total not available for display) would be displayed.

There are examples in the ZC code where such inspection to identify a specific/desired module is performed and could be used here.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

31 Jan 2018, 10:36 PM
#14
tmccaff avatar

tmccaff

Zen Follower

Join Date:
Jan 2018
Posts:
157
Plugin Contributions:
0

Post #14 by tmccaff

@davewest what template you using? Mine looks way different, I like your look. The way it looks in the screenshot I like, but mine is different.

I see your point mc12345678 so like if someone issues a reward credit this code may not work.

1 Feb 2018, 1:01 AM
#15
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Post #15 by davewest

I see your point assuming that any modified ot_totals addon would be added after the full oder total if I'm getting your point correctly. During my quick tests, the full order total was at the end of the array. I do have a few none standard ot_totals install on my test server. Will look into it further.

I first just did a if then statement looking for the text 'Total:' within the array, which worked if that was the site language.

I'm assuming they already know what was charged and saved or printed the final cart view. Posting the order total was all I was after, however, there's no reason why one could just display the full set of totals... looks like another button to add.

@tmccalff My site started with Responsive Sheffield Blue 1 and progress beyond it. For mods, I try to match the basic templates and hopefully you can modify to match your template style.

Dave
Always forward thinking... Lost my mind!

1 Feb 2018, 4:36 AM
#16
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #16 by mc12345678

Well, the if statement in question would like inspect the order_total->code variable to see if it equals ot_total. That is something that is not language dependent. If the module were cloned or for some unknown to me reason the $this->code assignment were otherwise modified to not be 'ot_total' then that would definitely be a condition that would need to be independently addressed.

So thinking that would do a loop something like:

$ot_mod = null;
foreach ($order->totals as $key =>$order_total) {
 if ($order_total['code'] == 'ot_total') {
    $ot_mod = $order_total;
    break;
 }
}
if (isset($ot_mod)) {
 //display information related to the order total using $ot_mod as the order_total "component"
}

At the end could add on an else statement and present whatever would be necessary if the ot_total module was not active.

Just a thought. :)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

1 Feb 2018, 11:19 PM
#17
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Post #17 by davewest

mc12345678:

Well, the if statement in question would like inspect the order_total->code variable to see if it equals ot_total. That is something that is not language dependent. If the module were cloned or for some unknown to me reason the $this->code assignment were otherwise modified to not be 'ot_total' then that would definitely be a condition that would need to be independently addressed.

So thinking that would do a loop something like:

$ot_mod = null;
foreach ($order->totals as $key =>$order_total) {
if ($order_total['code'] == 'ot_total') {
$ot_mod = $order_total;
break;
}
}
if (isset($ot_mod)) {
//display information related to the order total using $ot_mod as the order_total "component"
}

> 
> 
> 
> At the end could add on an else statement and present whatever would be necessary if the ot_total module was not active.
> 
> Just a thought. :)

That didn't work very good or the 3 other methods I tried with array search.  In the end a simple query of the table was the quickest answer. 

This is not creating or editing an order, but taking an existing order from the database and displaying its progress.  The same as one would find in account order history.  There is no need to activate an ot_total module at this point.

After examining the table and order class closer, I see it may be possible to have a key placed beyond the short order of 999 that ot_total is at.. 

I added a switch to display ether just the order total or the full list.  The full list would use the order class which nabs the info from the order totals table for display.  Using a simple table query to pull just the ot_total and presenting it as any table field would work just the order total.

Adding a switch to display one or the other, in hindsight, the full list would be better, but its nice to have options. Now to add the changes and send a update..

Dave
Always forward thinking... Lost my mind!

2 Feb 2018, 1:07 AM
#18
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #18 by mc12345678

Ok, so I had a chance to actually see this particular page and what is going on. Here is the revised code that returns both the order sub-total and order total as it originally intended but using a process that does not depend on the sequence nor whether one is enabled:

Replace:

<div class="ui-block-ff"><div class="ui-body ui-body-d">
<div class="orderHeading"><h2><?php echo TEXT_ORDER_TOTAL; ?></h2></div>
<br />
  <?php $i=2; ?>
<h2><?php echo TEXT_ORDER_SUB_TOTAL . $order->totals[0]['text'] . '<br />' . TEXT_TOTAL . $order->totals[2]['text']; ?></h2>
</div></div>

With:

<?php 
  $ot_sub = null;
  $ot_tot = null;
  
  foreach ($order->totals as $i=>$val) {
  
    if ($val['class'] == 'ot_total') {
      $ot_tot = $val;
    }
  
    if ($val['class'] == 'ot_subtotal') {
      $ot_sub = $val;
    }
  
    if (isset($ot_tot) && isset($ot_sub)) {
      break;
    }
  }
  
  if (isset($ot_sub) || isset($ot_tot)) { ?>
<div class="ui-block-ff"><div class="ui-body ui-body-d">
<div class="orderHeading"><h2><?php echo TEXT_ORDER_TOTAL; ?></h2></div>
<br />

  <h2><?php 
    if(isset($ot_sub)) {
      echo TEXT_ORDER_SUB_TOTAL . $ot_sub['text'] . '<br />';
    }

    if(isset($ot_tot)) {
      echo TEXT_TOTAL . $ot_tot['text'];
    }
   ?></h2></div></div><?php
  }
   ?>

I was wrong, for some reason I thought that the $order->totals was populated from the process function of the order_total class which would have included a 'code' array key... Instead, well needed, to use the 'class' key as above.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

2 Feb 2018, 3:33 PM
#19
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Post #19 by davewest

mc12345678:

Ok, so I had a chance to actually see this particular page and what is going on. Here is the revised code that returns both the order sub-total and order total as it originally intended but using a process that does not depend on the sequence nor whether one is enabled:

Replace:

<div class="ui-block-ff"><div class="ui-body ui-body-d"> <div class="orderHeading"><h2><?php echo TEXT_ORDER_TOTAL; ?></h2></div> <br /> <?php $i=2; ?> <h2><?php echo TEXT_ORDER_SUB_TOTAL . $order->totals[0]['text'] . '<br />' . TEXT_TOTAL . $order->totals[2]['text']; ?></h2> </div></div> ``` > > With: > ``` <?php $ot_sub = null; $ot_tot = null;

foreach ($order->totals as $i=>$val) {

if ($val['class'] == 'ot_total') {
  $ot_tot = $val;
}

if ($val['class'] == 'ot_subtotal') {
  $ot_sub = $val;
}

if (isset($ot_tot) && isset($ot_sub)) {
  break;
}

}

if (isset($ot_sub) || isset($ot_tot)) { ?>

<div class="ui-block-ff"><div class="ui-body ui-body-d"> <div class="orderHeading"><h2><?php echo TEXT_ORDER_TOTAL; ?></h2></div> <br /> <h2><?php if(isset($ot_sub)) { echo TEXT_ORDER_SUB_TOTAL . $ot_sub['text'] . '<br />'; }
if(isset($ot_tot)) {
  echo TEXT_TOTAL . $ot_tot['text'];
}

?></h2></div></div><?php } ?>

> 
> I was wrong, for some reason I thought that the $order->totals was populated from the process function of the order_total class which would have included a 'code' array key... Instead, well needed, to use the 'class' key as above.

One of the 3 I tried, but way to much work...  when in the header file line 116 one could do this:

$returntotal = $db->Execute("select text, class from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$orderID . "' and class = 'ot_total'");
$displaytotal = $returntotal->fields['text'];


and on the display side one could do this:

echo '<h1>'TEXT_ORDER_TOTAL . ' ' . $displaytotal . '</h1>';

Which is what was done partly. I added another switch and a bit more code to to have the option of showing just the total or the whole list.  Pulling the last key would of been nice, but like you pointed out, the store admin can change sort order right from admin missing up list key.
Thanks

Dave
Always forward thinking... Lost my mind!

2 Feb 2018, 4:32 PM
#20
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #20 by mc12345678

Always more than one way to accomplish the result. :)

Btw, saw that the includes/classes/order.php file was modified to support the plugin. There's a way to accomplish the goal without that modification (observer). Let me know if would like to see what I did and/or how you'd like it presented.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...