Zen Cart Logo
Forums / All Other Contributions/Addons / Return Authorization Module (RMA)

Return Authorization Module (RMA)

Views: 109,993

Results 581 to 600 of 644
23 Apr 2013, 2:51 AM
#581
xspresso avatar

xspresso

New Zenner

Join Date:
Sep 2008
Posts:
22
Plugin Contributions:
0

Return Authorization Module (RMA)

Reading his posts I could tell he is a really cool guy.
These days it seems rare to have caring, sharing people.
I never had the pleasure of meeting Clyde, but personally
I think Clyde would love the thought of his work making people happy.

23 Apr 2013, 2:52 AM
#582
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Return Authorization Module (RMA)

rbarbour:

Big shoes indeed, as the original author, his contributions will continue to serve and evolve with the community!

xspresso:

Reading his posts I could tell he is a really cool guy.
These days it seems rare to have caring, sharing people.
I never had the pleasure of meeting Clyde, but personally
I think Clyde would love the thought of his work making people happy.

nods in agreement:yes:

23 Apr 2013, 4:29 AM
#583
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

OK, so I put together code to display the success page.

WHAT THE FOLLOWING DOES

using the code from post#579

1.) I add a RMA Request button on the MY ACCOUNT > HISTORY > ORDER INFO page
2.) When clicked it sends that $orders_id to the returns page and populates the Order Number Field
3.) Send the same $orders_id to the returns success page

Now this code recreates and does away with the HTML from @xspresso post#581

Screenshot:
[Attachment no longer available]

First lets add the code to /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_returns_default.php

find:

<?php if (RETURN_STORE_NAME_ADDRESS == 'true') { ?>
<address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address>
<?php } ?>

<?php
  if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>

<br class="clearBoth" />
<div class="mainContent success"><?php echo TEXT_SUCCESS; ?></div>

<?php
  } else {
?>

Replace with:

<?php if (RETURN_STORE_NAME_ADDRESS == 'true' && ($_GET['action'] == 'success')) { ?>
<?php
/**
show nothing
 */
} else if (RETURN_STORE_NAME_ADDRESS == 'true') { ?>
<address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address>
<?php } ?>

<?php
  if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>
<br class="clearBoth" />

<div class="mainContent success">
<?php echo '<div id="returnSuccess">' . TEXT_SUCCESS . '</div>' . '<div id="returnRequired">'. TEXT_SUCCESS_RMA_REQUIRED . '</div>' . '<div id="returnPolicy">'. TEXT_SUCCESS_RMA_POLICY_BOF . '<a href="' . zen_href_link(FILENAME_SHIPPING, '', 'SSL') . '">' . TEXT_SUCCESS_RMA_POLICY_LINK . '</a>' . TEXT_SUCCESS_RMA_POLICY_EOF . '</div>' . '<div id="returnAddressWrapper">' . '<div id="returnRMA">' . TEXT_SUCCESS_RMA_ID; $order_number = $_GET['order_id']; echo $order_number . TEXT_SUCCESS_DASH; srand(5); echo(rand(1, 10)); echo(rand(1, 10)) . TEXT_SUCCESS_DASH . date('mdY') . '</div>' . '<div id="returnAddress">' . TEXT_SUCCESS_RMA_RETURN_ADDRESS . '</div>'; if (RETURN_STORE_NAME_ADDRESS == 'true') { echo '<address>' . nl2br(STORE_NAME_ADDRESS) . '</address>'; } echo '<div id="returnPhone">' . TEXT_SUCCESS_RMA_RETURN_PHONE . '</div>' . '</div>'; ?>

<?php
  } else {
?>

then open /includes/languages/english/YOUR_TEMPLATE_NAME/returns.php

and add:

define('TEXT_SUCCESS_RMA_REQUIRED', 'The below RMA# is required for all Returns');
define('TEXT_SUCCESS_RMA_POLICY_BOF', 'You can view our ');
define('TEXT_SUCCESS_RMA_POLICY_LINK', 'Returns Policy');
define('TEXT_SUCCESS_RMA_POLICY_EOF', ' here.');
define('TEXT_SUCCESS_RMA_ID', 'Your RMA# is: ');
define('TEXT_SUCCESS_DASH', '-');
define('TEXT_SUCCESS_RMA_RETURN_ADDRESS', 'Please ship all returns to this address:');
define('TEXT_SUCCESS_RMA_RETURN_PHONE', 'Phone: 1.111.111.1111');

and the CSS rules can be added to /includes/templates/YOUR_TEMPLATE_NAME/css/returns.css

div#returnAddressWrapper {border:1px solid #E9E9E9;background:#FFE573;text-align:center;}
div#returnSuccess {font-size:1.2em;padding:5px;color:#606060;}
div#returnAddressWrapper, div#returnRequired, div#returnPolicy, div#returnRMA, div#returnAddress, div#returnPhone {font-size:1.5em;font-weight:bold;padding:5px; }
div#returnRequired, div#returnAddress {color:#FF0000;}

That should be it, Enjoy!

23 Apr 2013, 1:19 PM
#584
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Return Authorization Module (RMA)

rbarbour:

OK, so I put together code to display the success page.

WHAT THE FOLLOWING DOES

using the code from post#579

1.) I add a RMA Request button on the MY ACCOUNT > HISTORY > ORDER INFO page
2.) When clicked it sends that $orders_id to the returns page and populates the Order Number Field
3.) Send the same $orders_id to the returns success page

Now this code recreates and does away with the HTML from @xspresso post#581

Screenshot:
[Attachment no longer available]

First lets add the code to /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_returns_default.php

find:

<?php if (RETURN_STORE_NAME_ADDRESS == 'true') { ?> <address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address> <?php } ?> <?php if (isset($_GET['action']) && ($_GET['action'] == 'success')) { ?> <br class="clearBoth" /> <div class="mainContent success"><?php echo TEXT_SUCCESS; ?></div> <?php } else { ?>
> 
> Replace with:
> ```php
<?php if (RETURN_STORE_NAME_ADDRESS == 'true' && ($_GET['action'] == 'success')) { ?>
<?php
/**
show nothing
 */
} else if (RETURN_STORE_NAME_ADDRESS == 'true') { ?>
<address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address>
<?php } ?>

<?php
  if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>
<br class="clearBoth" />

<div class="mainContent success">
<?php echo '<div id="returnSuccess">' . TEXT_SUCCESS . '</div>' . '<div id="returnRequired">'. TEXT_SUCCESS_RMA_REQUIRED . '</div>' . '<div id="returnPolicy">'. TEXT_SUCCESS_RMA_POLICY_BOF . '<a href="' . zen_href_link(FILENAME_SHIPPING, '', 'SSL') . '">' . TEXT_SUCCESS_RMA_POLICY_LINK . '</a>' . TEXT_SUCCESS_RMA_POLICY_EOF . '</div>' . '<div id="returnAddressWrapper">' . '<div id="returnRMA">' . TEXT_SUCCESS_RMA_ID; $order_number = $_GET['order_id']; echo $order_number . TEXT_SUCCESS_DASH; srand(5); echo(rand(1, 10)); echo(rand(1, 10)) . TEXT_SUCCESS_DASH . date('mdY') . '</div>' . '<div id="returnAddress">' . TEXT_SUCCESS_RMA_RETURN_ADDRESS . '</div>'; if (RETURN_STORE_NAME_ADDRESS == 'true') { echo '<address>' . nl2br(STORE_NAME_ADDRESS) . '</address>'; } echo '<div id="returnPhone">' . TEXT_SUCCESS_RMA_RETURN_PHONE . '</div>' . '</div>'; ?>

<?php
  } else {
?>

then open /includes/languages/english/YOUR_TEMPLATE_NAME/returns.php

and add:

define('TEXT_SUCCESS_RMA_REQUIRED', 'The below RMA# is required for all Returns');
define('TEXT_SUCCESS_RMA_POLICY_BOF', 'You can view our ');
define('TEXT_SUCCESS_RMA_POLICY_LINK', 'Returns Policy');
define('TEXT_SUCCESS_RMA_POLICY_EOF', ' here.');
define('TEXT_SUCCESS_RMA_ID', 'Your RMA# is: ');
define('TEXT_SUCCESS_DASH', '-');
define('TEXT_SUCCESS_RMA_RETURN_ADDRESS', 'Please ship all returns to this address:');
define('TEXT_SUCCESS_RMA_RETURN_PHONE', 'Phone: 1.111.111.1111');

> 
> and the CSS rules can be added to /includes/templates/YOUR_TEMPLATE_NAME/css/returns.css
> 
> ```
div#returnAddressWrapper {border:1px solid #E9E9E9;background:#FFE573;text-align:center;}
div#returnSuccess {font-size:1.2em;padding:5px;color:#606060;}
div#returnAddressWrapper, div#returnRequired, div#returnPolicy, div#returnRMA, div#returnAddress, div#returnPhone {font-size:1.5em;font-weight:bold;padding:5px; }
div#returnRequired, div#returnAddress {color:#FF0000;}

That should be it, Enjoy!

Fantastic! Now so I'm CLEAR.. this DOES NOT add the order number to the RMA success page if one accesses the RMA form directly correct?? If one accesses the RMA form directly they must enter the order number manually correct??

23 Apr 2013, 3:44 PM
#585
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

correct

23 Apr 2013, 4:31 PM
#586
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Return Authorization Module (RMA)

rbarbour:

correct
Awesome.. Nice code.. I will incorporate your code into the core.. I think it SHOULD be included.. and then I'll submit the whole bloody thing to the RIGHT place..:smile:

23 Apr 2013, 4:54 PM
#587
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

:bigups: Works for me! Thank you.

23 Apr 2013, 5:10 PM
#588
xspresso avatar

xspresso

New Zenner

Join Date:
Sep 2008
Posts:
22
Plugin Contributions:
0

Re: Return Authorization Module (RMA)

rbarbour:

OK, so I put together code to display the success page.

WHAT THE FOLLOWING DOES

using the code from post#579

1.) I add a RMA Request button on the MY ACCOUNT > HISTORY > ORDER INFO page
2.) When clicked it sends that $orders_id to the returns page and populates the Order Number Field
3.) Send the same $orders_id to the returns success page

Now this code recreates and does away with the HTML from @xspresso post#581

Screenshot:
[Attachment no longer available]

First lets add the code to /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_returns_default.php

find:

<?php if (RETURN_STORE_NAME_ADDRESS == 'true') { ?> <address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address> <?php } ?> <?php if (isset($_GET['action']) && ($_GET['action'] == 'success')) { ?> <br class="clearBoth" /> <div class="mainContent success"><?php echo TEXT_SUCCESS; ?></div> <?php } else { ?>
> 
> Replace with:
> ```php
<?php if (RETURN_STORE_NAME_ADDRESS == 'true' && ($_GET['action'] == 'success')) { ?>
<?php
/**
show nothing
 */
} else if (RETURN_STORE_NAME_ADDRESS == 'true') { ?>
<address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address>
<?php } ?>

<?php
  if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>
<br class="clearBoth" />

<div class="mainContent success">
<?php echo '<div id="returnSuccess">' . TEXT_SUCCESS . '</div>' . '<div id="returnRequired">'. TEXT_SUCCESS_RMA_REQUIRED . '</div>' . '<div id="returnPolicy">'. TEXT_SUCCESS_RMA_POLICY_BOF . '<a href="' . zen_href_link(FILENAME_SHIPPING, '', 'SSL') . '">' . TEXT_SUCCESS_RMA_POLICY_LINK . '</a>' . TEXT_SUCCESS_RMA_POLICY_EOF . '</div>' . '<div id="returnAddressWrapper">' . '<div id="returnRMA">' . TEXT_SUCCESS_RMA_ID; $order_number = $_GET['order_id']; echo $order_number . TEXT_SUCCESS_DASH; srand(5); echo(rand(1, 10)); echo(rand(1, 10)) . TEXT_SUCCESS_DASH . date('mdY') . '</div>' . '<div id="returnAddress">' . TEXT_SUCCESS_RMA_RETURN_ADDRESS . '</div>'; if (RETURN_STORE_NAME_ADDRESS == 'true') { echo '<address>' . nl2br(STORE_NAME_ADDRESS) . '</address>'; } echo '<div id="returnPhone">' . TEXT_SUCCESS_RMA_RETURN_PHONE . '</div>' . '</div>'; ?>

<?php
  } else {
?>

then open /includes/languages/english/YOUR_TEMPLATE_NAME/returns.php

and add:

define('TEXT_SUCCESS_RMA_REQUIRED', 'The below RMA# is required for all Returns');
define('TEXT_SUCCESS_RMA_POLICY_BOF', 'You can view our ');
define('TEXT_SUCCESS_RMA_POLICY_LINK', 'Returns Policy');
define('TEXT_SUCCESS_RMA_POLICY_EOF', ' here.');
define('TEXT_SUCCESS_RMA_ID', 'Your RMA# is: ');
define('TEXT_SUCCESS_DASH', '-');
define('TEXT_SUCCESS_RMA_RETURN_ADDRESS', 'Please ship all returns to this address:');
define('TEXT_SUCCESS_RMA_RETURN_PHONE', 'Phone: 1.111.111.1111');

> 
> and the CSS rules can be added to /includes/templates/YOUR_TEMPLATE_NAME/css/returns.css
> 
> ```
div#returnAddressWrapper {border:1px solid #E9E9E9;background:#FFE573;text-align:center;}
div#returnSuccess {font-size:1.2em;padding:5px;color:#606060;}
div#returnAddressWrapper, div#returnRequired, div#returnPolicy, div#returnRMA, div#returnAddress, div#returnPhone {font-size:1.5em;font-weight:bold;padding:5px; }
div#returnRequired, div#returnAddress {color:#FF0000;}

That should be it, Enjoy!

That is very nice work. It is everything I have been trying to do for a week.

24 Apr 2013, 3:54 AM
#589
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

xspresso:

That is very nice work. It is everything I have been trying to do for a week.

I'm glad we got it sorted and working :D

24 Apr 2013, 4:01 PM
#590
xspresso avatar

xspresso

New Zenner

Join Date:
Sep 2008
Posts:
22
Plugin Contributions:
0

Re: Return Authorization Module (RMA)

This allows the customer to receive the RMA # in their email.
I also laid-out the email to look better.

    // Prepare extra-info details
    $extra_info = email_collect_extra_info($name, $email_address, $customer_name, $customer_email, $telephone);
    // Prepare Text-only portion of message
	$text_message = OFFICE_FROM . "\t" . $name . "\n<br />" . 
		    OFFICE_EMAIL . "\t" . $email_address . "\n<br />" .
			"Phone Number:" . "\t" .$telephone . "\n<br />" .
		    "Address:" . "\t" . $address . "\n<br />" .
		    "City:" . "\t" . $city . "\n<br />" .
			"State:" . "\t" . $state . "\n<br />" .
		    "Post Code:" . "\t" . $postcode . "\n<br />" .
			"Country:" . "\t" . $country . "\n<br />" .
		    "Order Number:" . "\t" . $order_number . "\n<br />" .
		    "Total Value:" . "\t" . $value . "\n<br />" .
		    "Item Number:" . "\t" . $item_number . "\n<br />"	.
		    "Item(s) Name:" . "\t" . $item_name . "\n<br />"	.
		    "Action Requested:" . "\t" . $action . "\n\n<br />"	.
		     "RMA Number:" . "\t" . $order_number  . "-". date('mdY') . "\n<br />" .                  
			'------------------------------------------------------<br />' .
                   "\n\n<br />Reason:".    "\n\n<br />" .
                   "" . $reason .   "\n<br />" .
                  '------------------------------------------------------<br />' .  
      "" . "\n<br />" . 
      $extra_info['TEXT'];
      $email_text = sprintf(EMAIL_GREET_NONE, $name );
      $email_text .=  "\n <br />";
      $email_text .=  EMAIL_WELCOME;
      $email_text .=  "\n\n" . "Request Date:" . "\t" . date('m/d/Y') . "\n<br />" ;
      $email_text .=  "\n" . "Invoice Number:" . "\t" . $order_number . "<br />" ;
      $email_text .=  "\n" . "Item(s)You Are Returning: (as you entered it)" . "\t" . $item_name . "<br />";
      $email_text .=  "\n" . "RMA Number:" . "\t" . $order_number  . "-". date('mdY') . "\n<br />";
      $email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;

I have a concern from post # 588. The code I gave you for the generator srand(5); echo(rand(1, 10)); echo(rand(1, 10)) is wrong.
This one is a 3 digit generator. BUT... my problem is: using this will make the "emailed RMA" different from the RMA that comes back in the success page. So maybe just remove it all together.

$digits = 3; 
echo(rand(pow, 10)); 
$digits-1)), pow(10, $digits)-1))

unless you can carry the generated 3 digit number to the email:
```
$email_text .= "\n" . "RMA Number:" . "\t" . $3digit_number . "-". $order_number . "-". date('mdY') . "\n<br />";

24 Apr 2013, 8:45 PM
#591
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

Seeing how the random 3 digit number doesn't really serve a purpose anyway, why not just replace it with a value that could help reference the RMA# with the:

A) Original Order Number
B) Customer's ID
C) RMA# Request Date

This way it can be sent to email when form is submitted and passed to the success page - and never regenerating a different RMA#

24 Apr 2013, 8:47 PM
#592
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Return Authorization Module (RMA)

rbarbour:

Seeing how the random 3 digit number doesn't really serve a purpose anyway, why not just replace it with a value that could help reference the RMA# with the:

A) Original Order Number
B) Customer's ID
C) RMA# Request Date

This way it can be sent to email when form is submitted and passed to the success page - and never regenerating a different RMA#

nods in agreement.. these elements will make the number sufficiently unique without the need for a random generated number.. No need to do anything fancy..

24 Apr 2013, 9:30 PM
#593
xspresso avatar

xspresso

New Zenner

Join Date:
Sep 2008
Posts:
22
Plugin Contributions:
0

Re: Return Authorization Module (RMA)

That is good, just drop the random part and now the order# (aka: customer id or invoice no.) and date is more then enough to track the order as an RMA.

Now there is one final thing I believe the RMA needs to do.

Change the database status from complete (or whatever) to RMA Requested.

I think in header_php.php after sending mail, open database and change the status.

24 Apr 2013, 9:38 PM
#594
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

Maybe in a future release :cool:

24 Apr 2013, 11:58 PM
#595
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

DivaVocals:

Awesome.. Nice code.. I will incorporate your code into the core.. I think it SHOULD be included.. and then I'll submit the whole bloody thing to the RIGHT place..:smile:

So many changes - for the better, Yes?

1> I re-wrote the code to do-away with the random 3 digit numbers and added customer id in its place.

2> I added a hidden input field to the stores returns page for the RMA#

3> I added the RMA# to the email

4> I added a sql query to the success page to update the order status via admin (),
I am thinking this should have a ADMIN control where the status_id can be entered for all sites will differ depending on how many order statuses they currently have.

Here is the UPDATED and at the moment FINAL CODE

1.) lets create a button
1.A) /includes/languages/english/YOUR_TEMPLATE_NAME/button_names.php

ADD:

define('BUTTON_RMA_REQUEST', 'button_rma_request.png');
define('BUTTON_RMA_REQUEST_ALT', 'Request an RMA#');

1.b) upload your button
/includes/templates/YOUR_TEMPLATE_NAME/buttons/english

  1. lets add the button to the My Account > History > Order Info page
    2.A) /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_account_history_info_default.php

I added my button at the end of the file right after the <br class="clearBoth" /> and closing </div>

ADD:

<div class="rmaRequestButton"><?php echo '<a href="' . zen_href_link(FILENAME_RETURNS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'order_id=' . $_GET['order_id'], 'SSL') . '">' . zen_image_button(BUTTON_RMA_REQUEST) . '</a>'; ?></div>

3.) /includes/modules/pages/returns/header_php.php

find:

    $order_number = zen_db_prepare_input($_POST['order_number']);

below that ADD:

    $rma_number = zen_db_prepare_input($_POST['rma_number']);

then find:

"Order Number:" . "\t" . $order_number . "<br />" .

below that ADD:

"RMA Number:" . "\t" . $rma_number . "<br />" .

then find:
zen_redirect(zen_href_link(FILENAME_RETURNS, 'action=success'));
**
CHANGE TO:**

      zen_redirect(zen_href_link(FILENAME_RETURNS, 'action=success' . '&order_id=' . $order_number));

then find:

  $city = $check_customer->fields['entry_city'];

below that ADD:

$cID = $check_customer->fields['customers_id'];

then find:

  $postcode = $check_customer->fields['entry_postcode'];
}

below that **ADD:
**```php
$customer_info_query = "SELECT customers_id
FROM " . TABLE_ORDERS . "
WHERE orders_id = :ordersID";

$customer_info_query = $db->bindVars($customer_info_query, ':ordersID', $_GET['order_id'], 'integer');
$customer_info = $db->Execute($customer_info_query);

$order_number = $_GET['order_id'];
$rma_request_date = date('mdY');
$rma_number = $order_number . TEXT_SUCCESS_DASH . $cID . TEXT_SUCCESS_DASH . $rma_request_date;


Now in /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_returns_default.php
 find:
```php
<?php if (RETURN_STORE_NAME_ADDRESS == 'true') { ?>
<address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address>
<?php } ?>

<?php
  if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>

<br class="clearBoth" />
<div class="mainContent success"><?php echo TEXT_SUCCESS; ?></div>

<?php
  } else {
?>

**CHANGE TO:
**```php

<?php if (RETURN_STORE_NAME_ADDRESS == 'true' && ($_GET['action'] == 'success')) { ?> <?php /** show nothing */ } else if (RETURN_STORE_NAME_ADDRESS == 'true') { ?> <address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address> <?php } ?> <?php if (isset($_GET['action']) && ($_GET['action'] == 'success')) { ?> <br class="clearBoth" /> <div class="mainContent success"> <?php echo '<div id="returnSuccess">' . TEXT_SUCCESS . '</div>' . '<div id="returnRequired">'. TEXT_SUCCESS_RMA_REQUIRED . '</div>' . '<div id="returnPolicy">'. TEXT_SUCCESS_RMA_POLICY_BOF . '<a href="' . zen_href_link(FILENAME_SHIPPING, '', 'SSL') . '">' . TEXT_SUCCESS_RMA_POLICY_LINK . '</a>' . TEXT_SUCCESS_RMA_POLICY_EOF . '</div>' . '<div id="returnAddressWrapper">' . '<div id="returnRMA">' . TEXT_SUCCESS_RMA_ID . $rma_number . '</div>' . '<div id="returnAddress">' . TEXT_SUCCESS_RMA_RETURN_ADDRESS . '</div>'; if (RETURN_STORE_NAME_ADDRESS == 'true') { echo '<address>' . nl2br(STORE_NAME_ADDRESS) . '</address>'; } echo '<div id="returnPhone">' . TEXT_SUCCESS_RMA_RETURN_PHONE . '</div>' . '</div>'; ?> <?php $orderID = $_GET['order_id']; $db->Execute("update " . TABLE_ORDERS . " set orders_status = '5', last_modified = now() where orders_id = '" . (int)$orderID . "'"); ?> <?php } else { ?>

**The Number 5 represents the order status ID in ADMIN > LOCALIZATION > ORDERS STATUS

ADD "Pending Return", look at your browser page link - you will see oID=#, that # needs to replace the above 5**

then find:
```php
<br class="clearBoth" />
<?php
  if (RETURN_ITEM_NAME == 'true') {
?>

ABOVE the <br class="clearBoth" />
ADD:

<?php  echo '<input type="hidden" name="rma_number" value="'.$rma_number.'">'; ?>

then open /includes/languages/english/YOUR_TEMPLATE_NAME/returns.php
DID NOT CHANGE FROM PREVIOUS POSTS

define('TEXT_SUCCESS', 'Your request has been successfully submitted.');
define('TEXT_SUCCESS_RMA_REQUIRED', 'The below RMA# is required for all Returns');
define('TEXT_SUCCESS_RMA_POLICY_BOF', 'You can view our ');
define('TEXT_SUCCESS_RMA_POLICY_LINK', 'Returns Policy');
define('TEXT_SUCCESS_RMA_POLICY_EOF', ' here.');
define('TEXT_SUCCESS_RMA_ID', 'Your RMA# is: ');
define('TEXT_SUCCESS_DASH', '-');
define('TEXT_SUCCESS_RMA_RETURN_ADDRESS', 'Please ship all returns to this address:');
define('TEXT_SUCCESS_RMA_RETURN_PHONE', 'Phone: 1.111.111.1111');

and the CSS rules can be added to /includes/templates/YOUR_TEMPLATE_NAME/css/returns.css
DID NOT CHANGE FROM PREVIOUS POSTS

div#returnAddressWrapper {border:1px solid #E9E9E9;background:#FFE573;text-align:center;} div#returnSuccess {font-size:1.2em;padding:5px;color:#606060;} div#returnAddressWrapper, div#returnRequired, div#returnPolicy, div#returnRMA, div#returnAddress, div#returnPhone {font-size:1.5em;font-weight:bold;padding:5px; } div#returnRequired, div#returnAddress {color:#FF0000;}

I hope this helps and I haven't completely confused everyone.

25 Apr 2013, 3:34 AM
#596
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Return Authorization Module (RMA)

Indeed.. regarding item #4.. I think that what would be better and keep folks out of the code is to add this to the admin menu where folks can select from existing statuses in their store. This would keep folks "out of the code" and make it easier to implement.. I know the change to make in the install SQL to add this option..

something like this should do the trick:

INSERT INTO configuration VALUES (NULL, 'Auto Status - RMA', 'AUTO_STATUS_RMA', '2', 'Number of the order status assigned when an RMA is submitted.', @t4, 5, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');

Not so sure what the code below have to look like to use the selected status.. HELP!!

rbarbour:

So many changes - for the better, Yes?

1> I re-wrote the code to do-away with the random 3 digit numbers and added customer id in its place.

2> I added a hidden input field to the stores returns page for the RMA#

3> I added the RMA# to the email

4> I added a sql query to the success page to update the order status via admin (),
I am thinking this should have a ADMIN control where the status_id can be entered for all sites will differ depending on how many order statuses they currently have.

Here is the UPDATED and at the moment FINAL CODE

1.) lets create a button
1.A) /includes/languages/english/YOUR_TEMPLATE_NAME/button_names.php

ADD:

define('BUTTON_RMA_REQUEST', 'button_rma_request.png');
define('BUTTON_RMA_REQUEST_ALT', 'Request an RMA#');

> 
> 1.b) upload your button
> /includes/templates/YOUR_TEMPLATE_NAME/buttons/english
> 
> 2. lets add the button to the My Account > History > Order Info page
> 2.A) /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_account_history_info_default.php
> 
> I added my button at the end of the file right after the <br class="clearBoth" /> and closing </div>
> 
> **ADD:**
> ```php
<div class="rmaRequestButton"><?php echo '<a href="' . zen_href_link(FILENAME_RETURNS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'order_id=' . $_GET['order_id'], 'SSL') . '">' . zen_image_button(BUTTON_RMA_REQUEST) . '</a>'; ?></div>

3.) /includes/modules/pages/returns/header_php.php

find:

$order_number = zen_db_prepare_input($_POST['order_number']);
> 
> below that **ADD:**
> ```php
    $rma_number = zen_db_prepare_input($_POST['rma_number']);

then find:

"Order Number:" . "\t" . $order_number . "<br />" .

> 
> below that **ADD:**
> ```php
"RMA Number:" . "\t" . $rma_number . "<br />" .

then find:
zen_redirect(zen_href_link(FILENAME_RETURNS, 'action=success'));
**
CHANGE TO:**

  zen_redirect(zen_href_link(FILENAME_RETURNS, 'action=success' . '&order_id=' . $order_number));
> 
> then find:
> ```php
  $city = $check_customer->fields['entry_city'];

below that ADD:

$cID = $check_customer->fields['customers_id'];

> 
> then find:
> ```php
  $postcode = $check_customer->fields['entry_postcode'];
}

below that **ADD:
**```php
$customer_info_query = "SELECT customers_id
FROM " . TABLE_ORDERS . "
WHERE orders_id = :ordersID";

$customer_info_query = $db->bindVars($customer_info_query, ':ordersID', $_GET['order_id'], 'integer');
$customer_info = $db->Execute($customer_info_query);

$order_number = $_GET['order_id'];
$rma_request_date = date('mdY');
$rma_number = $order_number . TEXT_SUCCESS_DASH . $cID . TEXT_SUCCESS_DASH . $rma_request_date;

> 
> Now in /includes/templates/YOUR_TEMPLATE_NAME/templates/tpl_returns_default.php
>  find:
> ```php
<?php if (RETURN_STORE_NAME_ADDRESS == 'true') { ?>
<address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address>
<?php } ?>

<?php
  if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>

<br class="clearBoth" />
<div class="mainContent success"><?php echo TEXT_SUCCESS; ?></div>

<?php
  } else {
?>

**CHANGE TO:
**```php

<?php if (RETURN_STORE_NAME_ADDRESS == 'true' && ($_GET['action'] == 'success')) { ?> <?php /** show nothing */ } else if (RETURN_STORE_NAME_ADDRESS == 'true') { ?> <address><?php echo nl2br(STORE_NAME_ADDRESS); ?></address> <?php } ?> <?php if (isset($_GET['action']) && ($_GET['action'] == 'success')) { ?> <br class="clearBoth" /> <div class="mainContent success"> <?php echo '<div id="returnSuccess">' . TEXT_SUCCESS . '</div>' . '<div id="returnRequired">'. TEXT_SUCCESS_RMA_REQUIRED . '</div>' . '<div id="returnPolicy">'. TEXT_SUCCESS_RMA_POLICY_BOF . '<a href="' . zen_href_link(FILENAME_SHIPPING, '', 'SSL') . '">' . TEXT_SUCCESS_RMA_POLICY_LINK . '</a>' . TEXT_SUCCESS_RMA_POLICY_EOF . '</div>' . '<div id="returnAddressWrapper">' . '<div id="returnRMA">' . TEXT_SUCCESS_RMA_ID . $rma_number . '</div>' . '<div id="returnAddress">' . TEXT_SUCCESS_RMA_RETURN_ADDRESS . '</div>'; if (RETURN_STORE_NAME_ADDRESS == 'true') { echo '<address>' . nl2br(STORE_NAME_ADDRESS) . '</address>'; } echo '<div id="returnPhone">' . TEXT_SUCCESS_RMA_RETURN_PHONE . '</div>' . '</div>'; ?> <?php $orderID = $_GET['order_id']; $db->Execute("update " . TABLE_ORDERS . " set orders_status = '5', last_modified = now() where orders_id = '" . (int)$orderID . "'"); ?> <?php } else { ?>
> 
> **The Number 5 represents the order status ID in ADMIN > LOCALIZATION > ORDERS STATUS
> 
> ADD "Pending Return", look at your browser page link - you will see oID=#, that # needs to replace the above 5**
> 
> then find:
> ```php
<br class="clearBoth" />
<?php
  if (RETURN_ITEM_NAME == 'true') {
?>

ABOVE the <br class="clearBoth" />
ADD:

<?php echo '<input type="hidden" name="rma_number" value="'.$rma_number.'">'; ?>
> 
> then open /includes/languages/english/YOUR_TEMPLATE_NAME/returns.php
> **DID NOT CHANGE FROM PREVIOUS POSTS**
> 
> ```php
define('TEXT_SUCCESS', 'Your request has been successfully submitted.');
define('TEXT_SUCCESS_RMA_REQUIRED', 'The below RMA# is required for all Returns');
define('TEXT_SUCCESS_RMA_POLICY_BOF', 'You can view our ');
define('TEXT_SUCCESS_RMA_POLICY_LINK', 'Returns Policy');
define('TEXT_SUCCESS_RMA_POLICY_EOF', ' here.');
define('TEXT_SUCCESS_RMA_ID', 'Your RMA# is: ');
define('TEXT_SUCCESS_DASH', '-');
define('TEXT_SUCCESS_RMA_RETURN_ADDRESS', 'Please ship all returns to this address:');
define('TEXT_SUCCESS_RMA_RETURN_PHONE', 'Phone: 1.111.111.1111');

and the CSS rules can be added to /includes/templates/YOUR_TEMPLATE_NAME/css/returns.css
DID NOT CHANGE FROM PREVIOUS POSTS

div#returnAddressWrapper {border:1px solid #E9E9E9;background:#FFE573;text-align:center;} div#returnSuccess {font-size:1.2em;padding:5px;color:#606060;} div#returnAddressWrapper, div#returnRequired, div#returnPolicy, div#returnRMA, div#returnAddress, div#returnPhone {font-size:1.5em;font-weight:bold;padding:5px; } div#returnRequired, div#returnAddress {color:#FF0000;}

> 
> I hope this helps and I haven't completely confused everyone.
25 Apr 2013, 5:26 AM
#597
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

<?php $autoRMA = AUTO_STATUS_RMA; $orderID = $_GET['order_id']; $db->Execute("update " . TABLE_ORDERS . " set orders_status = $autoRMA, last_modified = now() where orders_id = '" . (int)$orderID . "'"); ?>
25 Apr 2013, 5:38 AM
#598
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Return Authorization Module (RMA)

rbarbour:

<?php $autoRMA = AUTO_STATUS_RMA; $orderID = $_GET['order_id']; $db->Execute("update " . TABLE_ORDERS . " set orders_status = $autoRMA, last_modified = now() where orders_id = '" . (int)$orderID . "'"); ?>

Now we're cookin' with Crisco!!! I'll bundle this up and submit.. BTW.. If I haven't said it... you're awesome. Been stalking..err.. I mean watching all the helpful stuff you've been posting.. good stuff..

25 Apr 2013, 5:54 AM
#599
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Return Authorization Module (RMA)

Believe it or not, I do allot if searching and reading to "mainly" find easy and simple solution to incorporate into client websites to efficiently create the functions they require to successfully operate their e-commerce website.

Along the way, I add my two cents and if I think an idea or suggestion will enhance zen cart functionality for the vast majority, I will take the time to help make it work (where I can). Their are far more knowledgeable on this forum than I.

And thank you, it is good to hear a fellow contributor appreciate another.

Now stop stalking me, I mean watching. JUST KIDDING :blush:

25 Apr 2013, 1:41 PM
#600
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Return Authorization Module (RMA)

rbarbour:

And thank you, it is good to hear a fellow contributor appreciate another.

Now stop stalking me, I mean watching. JUST KIDDING :blush:I will not I will not I will not!!!:laugh: