
Originally Posted by
Mike_Dean
Would help if I showed you what I edited it too !!
if ( $description == "Registered Parcel Service(x2)") { $quote->description = "Registered Parcel (Bulk Service)" ; $description = "Registered Parcel (Bulk Service)" ; }
if ( $description == "Registered Courier Service(x2)") { $quote->description = "Registered Courier (Bulk Service)" ; $description = "Registered Courier (Bulk Service)" ; }
Line 659 currently/originally reads:
Code:
if ( MODULE_SHIPPING_OZPOST_CORE_WEIGHT == "Yes" && $shipping_num_boxes > 1 ) { $description .= "(x".$shipping_num_boxes.")"; $quote->description = $quote->description." (x".$shipping_num_boxes.")" ;}
Change like this:
Code:
if ( MODULE_SHIPPING_OZPOST_CORE_WEIGHT == "Yes" && $shipping_num_boxes > 1 ) {
$description .= "(Bulk Service)";
$quote->description = $quote->description." (Bulk Service)" ;
}
If you are lucky you should even be able to cut/paste this code snippet (I haven't tested it though).
What this code is doing is first checking that the quote consists of multiple parcels, doing nothing if not, but *appending* the '(Bulk Service)" to the existing description(s) if the conditions match.
The modified code is simpler than the original because it doesn't use any variables in the text strings (the variable being the $shipping_num_boxes.
The code that you used could never work in place of the original line because
Code:
if ( $description == "Registered Parcel Service(x2)")
would never evaluate as TRUE since the "(x2)" hasn't been set at this point.
I can see how you may have opted to add this code *after* the line I suggested be modified, and it would work, but only under the specific condition that the quote is/was for 2 parcels, no more, no less.
In order to allow for a variable number of parcels using this method will require the code to read something like
Code:
if ( $description == "Registered Parcel Service(x".$shipping_num_boxes.")")
etc, etc
This way the text to be matched is constantly kept updated with the same data that was used to create the original text string, in which case why not use and change where the text is/was created in the first place and avoid this additional check? (Rhetorical question)
Cheers
Rod
Bookmarks