Barclays epdq pspid integration error : Invalid ItemName field length - magento

I have integrated barclay card payment into my website and when i do a cardpayment i get the following error message
Invalid ItemName field length: "Product name --- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxburgandy" (54 MIN : 0 MAX : 40)
in the page https://payments.epdq.co.uk/ncol/prod/orderstandard.asp

REASON for the error : The error is being caused by the Product name / sku being too long. The parameter is limited to a maximum of 40 characters (including spaces).
In order to resolve this issue, you need to pass an item name that is less than 40 characters long.
SOLUTION:
Before submitting the form to https://payments.epdq.co.uk/ncol/prod/orderstandard.asp just delimit the itemname and id as shown below
//Fix for only 40 characters of length for itemname ITEMNAME*XX*
$ordername = substr($ordername, 0, 40);
$sku = substr($sku, 0, 15);
//Fix - End
$html .= '<input type="hidden" name="ITEMID'.$counter.'" value="'.$sku.'">';
$html .= '<input type="hidden" name="ITEMNAME'.$counter.'" value="'.$ordername.'">';

Related

HOW TO CHANGE DATATABLE ROW GROUP COLOR

I want to change the colour of the grouped row in a datatable. I just can't seem to get it to work the way I would like and I'm unsure how to get it too. I have done a drawback and get this to work in the group header but for the life of me I can't get it to work in the grouped row footer.
rowGroup: {
/// Group Header Colour
//startRender: null, SET TO NULL IF GROUP HEADER NOT REQUIRED
startRender: function(rows, group) {
// colour the group header and uncomment to show
// return $('<tr class="group group-start"><td class="' + (group == '1' ? 'green' : (group == '0' ? 'green' : 'green')) + '" colspan="9">' + group + ' ' + ' ('+rows.count() + '</td></tr>');
},
// Below used for Grouping and summing at end of each dept in this case
endRender: function ( rows, group ) {
var filteredData = $('#giftcards').DataTable()
.rows()
.data()
.filter( function ( data, index ) {
return data[groupColumn] == group ? true : false;
} )
.pluck(6) // the column we are counting in this case retail value per dept
.sum();
//return 'Dept: <tr class="rowgroup"><td colspan="9">' + group + '('+ rows.count() + ' rows on page , £' + roundTo(filteredData,2) + 'Retail Sale value for all pages)'; /// Needs multiplied by PD.TotalShelfstockQuantity
return 'Dept: <tr class="group group-start"><td class="' + (group == '1' ? 'green' : (group == '0' ? 'green' : 'green')) + '" colspan="11">' + group + ' ' + '('+ rows.count() +')'
+ ' rows on page , <larger>£ </larger>' + roundTo(filteredData,2) + ' Retail Sale value for all pages)' + '</td></tr>'; /// Needs multiplied by PD.TotalShelfstockQuantity
// $(row).css("background-color", "green");
},
dataSrc: groupColumn,
//backgroundColor = styleEqual('Dept','red')
},`
```
THE BELOW PIECE OF CODE SEEMS TO BE ALMOST THERE - HOWEVER, IT IS ONLY SHOWING IN A FEW COLUMNS - I am not a programmer by the way.
```
return 'Dept: <tr class="group group-start"><td class="' + (group == '1' ? 'green' : (group == '0' ? 'green' : 'green')) + '" colspan="11">' + group + ' ' + '('+ rows.count() +')'
+ ' rows on page , <larger>£ </larger>' + roundTo(filteredData,2) + ' Retail Sale value for all pages)' + '</td></tr>';
```
Thanks in advance. Below is the status as is at minute. I would like the green to populate the entire row.
[![enter image description here](https://i.stack.imgur.com/P46Rz.png)](https://i.stack.imgur.com/P46Rz.png)
I have tried various solutions that were on this forum but I am missing something. I know that' I'm close but no cigar.

Magento 2 - wrong number of digits between separators for prices in Indian Rupees

I am using Magento 2.2.3. my default currency is INR, but it shows in the wrong format:
But it should be ₹77,65,000.00. How do we correct price format? Currently its wrong... like USD.
You can set the currency format by following code.
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of Object Manager
$priceHelper = $objectManager->create('Magento\Framework\Pricing\Helper\Data'); // Instance of Pricing Helper
$price = 1000; //Your Price
$formattedPrice = $priceHelper->currency($price, true, false);
?>
File path: vendor/magento/zendframework1/library/Zend/Locale/Data/en.xml
On line number 3353, under section currencyFormat and type = "standard", change the pattern from <pattern>¤#,##0.00</pattern> to <pattern>¤ #,##,##0.00</pattern>
Still, on PDP page and cart page summary the price format does not change because the prize format is coming from the JS in which Magento using a RegExp function for only US price format.
For that, please change the code in the below file.
File path: vendor/magento/module-catalog/view/base/web/js/price-utils.js (First extend this file in your theme directory and do the respected changes)
Under the function formatPrice below this line comment all the line in the respective function.
i = parseInt(
amount = Number(Math.round(Math.abs(+amount || 0) + 'e+' + precision) + ('e-' + precision)),
10
) + '';
And add this set of code below the above line.
var x=i;
x=x.toString();
var afterPoint = '';
if(x.indexOf('.') > 0)
afterPoint = x.substring(x.indexOf('.'),x.length);
x = Math.floor(x);
x=x.toString();
var lastThree = x.substring(x.length-3);
var otherNumbers = x.substring(0,x.length-3);
if(otherNumbers != '')
lastThree = ',' + lastThree;
var response = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree + afterPoint;
return pattern.replace('%s', response);
deploy and `rm -rf var/cache/*
And then you're done. For Example: A price previously displayed like 453,453, will now display in the Indian manner like 4,53,453.

Why is my dataveiw filter crashing

i have a dataview from a data table i am trying to filter to see if there are duplicate values for a manufacture, Type and Serial number but i am getting an error
string strFilter = "Manufacture = " + strMake + " and Type = " + strModel + " and Serial Number = " + strSn;
strfilter = "Manufacture = ford 150 and Type = Raptor and Serial Number = 9999"
dv.RowFilter = strFilter;
this it the error i am getting
An unhandled exception of type 'System.Data.SyntaxErrorException' occurred in System.Data.dll
Additional information: Syntax error: Missing operand after 'Number' operator
You need single quotes for strings.Write serial number in brackets like [Serial number] if that is the name of your column.
For one you are missing a semi colon here.
strfilter = "Manufacture = ford 150 and Type = Raptor and Serial Number = 9999" <---------
:)

\r\n not working but \r\n\r\n works

I am sending an email via CodeIgniter's email->send(). I have come across an anomaly that I cannot figure out.
"\r\n" is not working in a certain section of the email. However if I switch "\r\n" to "\r\n\r\n" it works. By works I mean, it adds the 2 line breaks expected.
The problem area is at the bottom.
$order = $this->ordersclass->getOrder( $order_id );
$quantity = $order['no_codes'];
$client = $this->clientclass->getClient( $order['client_id'] );
$multi_d = $this->session->userdata('multi-use-codes-d');
$multi_t = $this->session->userdata('multi-use-codes-t');
$this->load->library('email');
$to = $client['client_email'];
$subject = 'Personal Resiliency Builder Order';
$from = 'accounts#resiliencybuilder.com.au';
$message = "TAX INVOICE\r\n\r\n";
$message .= "Client Name: ". $client['client_name']."\r\n";
$message .= "Invoice Number: ".$order['order_id']."\r\n";
$message .= "Invoice Date: ".$order['order_timestamp']."\r\n\r\n";
$message .= "TOTAL AMOUNT PAYABLE: $".number_format($order['order_amount'],2)."\r\n";
$message .= "GST ON SERVICES: $".number_format(($order['order_amount']/110)*10,2)."\r\n\r\n";
$message .= "ACCOUNT PAID IN FULL VIA CREDIT CARD\r\n\r\n";
$message .= "=============================================================\r\n";
$message .= "DESCRIPTION OF SERVICES\r\n\r\n";
$message .= "Code List Name: ".$this->session->userdata('codelistname') . "\r\n";
$message .= "Quantity: ".$quantity ."\r\n";
$message .= "Single-use Developmental Reports Purchased: ".$order['no_codes_d']."\r\n";
$message .= "Single-use Thriving Reports Purchased: ".$order['no_codes_t']."\r\n";
The last 2 $message variables are the problem.
The email looks like this:
TOTAL AMOUNT PAYABLE: $1,771.00
GST ON SERVICES: $161.00
ACCOUNT PAID IN FULL VIA CREDIT CARD
=============================================================
DESCRIPTION OF SERVICES
Code List Name: fggdgfdgfd
Quantity: 12
Single-use Developmental Reports Purchased: 7 Single-use Thriving
Reports Purchased: 5
Multi-use Developmental Reports Purchased: 5
Multi-use Thriving Reports Purchased: 5
SOLVED. Now looking for the understanding behind it.
After many tests, the formula for failure is: Failure = X + Y:
Failure = X character length + spaces.
In addition, it seams this problem occurs with Microsoft outlook 20xx, but not with hotmail or gmail.
Example:
$message .= "Single-use: Developmental Reports : ddddd\r\n"; ////// fail - length 41
$message .= "Single-use: DevelopmentaldReportsd:dddddd\r\n"; /// fail - length 41
$message .= "Single-use:dDevelopmentaldReportsd:dddddd\r\n"; // pass - length 41
$message .= "Single-use:DevelopmentaldReportsd:dddddddddddddddddddddddddddddd\r\n"; // pass
NOTE: This answer is for developers using CodeIgniter version 2.1.3
This is not tested on any other PHP Framework.
Based on many tests via changing the character length, adding/removing spaces, and testing with different email services:
Outlook version 20xx
Hotmail
Gmail
It is safe to conclude that CodeIgniter version 2.1.3 parses the message in such a way that given a string length around 40 characters long + 1 space character + a newline character and sending the email to all three email serves above, that only Outlook will determine that the newline character is an "Extra" newline character and therefore remove it.
It is possible to change outlooks settings to disable Outlook from removing extra newline characters
As the link suggests: Microsoft Outlook Guide to disabling Extra Newline Removal
EASY DEVELOPER SOLUTION:
Keep your string length to a maximum 39 characters including spaces.

Magento: How to remove the price for bundled product options on the shopping cart page, checkout etc

Please help me removing the price for bundled product options on the shopping cart page, checkout, etc. Here is a pic.
What do i need to do?
To remove this edit:
Mage_Bundle_Block_Checkout_Cart_Item_Renderer
Look for the _getBundleOptions() method and at around line 77 change it as follows
//$option['value'][] = $this->_getSelectionQty($bundleSelection->getSelectionId()).' x '. $this->htmlEscape($bundleSelection->getName()). ' ' .Mage::helper('core')->currency($this->_getSelectionFinalPrice($bundleSelection));
//New line
$option['value'][] = $this->_getSelectionQty($bundleSelection->getSelectionId()).' x '. $this->htmlEscape($bundleSelection->getName());
Then edit:
Mage_Bundle_Block_Sales_Order_Items_Renderer
Look for the getValueHtml() method at around line 115 change the code as follows
public function getValueHtml($item)
{
if ($attributes = $this->getSelectionAttributes($item)) {
//Old code
/*
return sprintf('%d', $attributes['qty']) . ' x ' .
$this->htmlEscape($item->getName()) .
" " . $this->getOrder()->formatPrice($attributes['price']);
*/
return sprintf('%d', $attributes['qty']) . ' x ' .
$this->htmlEscape($item->getName());
} else {
return $this->htmlEscape($item->getName());
}
}
The usual caveats about not editing core code and using local or module rewrites apply!
let me know if i can help you more.
OR Also you can hide with css like below
Assuming that you want to remove it from all items regardless of the price, then you could add this css
#shopping-cart-table dd span.price{
display:none;
}
If you only want to remove the price if it is zero,you can also do in this way
/app/design/frontend/default/{theme path}/template/checkout/cart/item/default.phtml (around line # 46)
Figure out where it is add the price and only append the price if it is greater than 0
or
Do a find a replace str_replace("$0.00", "", $_formatedOptionValue['value']) on the string that display that line (make sure to add the currency sign so that $10.00 dont get replace)
I found another way to do it. Hopefully it will help somebody.
1 - Go to /public_html/app/code/core/Mage/Bundle/Helper/Catalog/Product
2 - open the file Configuration.php
3 - from about line 119 till about 127 you will find this code:
foreach ($bundleSelections as $bundleSelection) {
$qty = $this->getSelectionQty($product, $bundleSelection->getSelectionId()) * 1;
if ($qty) {
$option['value'][] = $qty . ' x ' . $this->escapeHtml($bundleSelection->getName())
. ' ' . Mage::helper('core')->currency(
$this->getSelectionFinalPrice($item, $bundleSelection)
);
}
}
Change that with this code:
foreach ($bundleSelections as $bundleSelection) {
$qty = $this->getSelectionQty($product, $bundleSelection->getSelectionId()) * 1;
if ($qty) {
$option['value'][] = $this->escapeHtml($bundleSelection->getName());
}
}
One caution note, be careful about editing the core file. You can also use local or module rewrites.

Resources