My client would like to pass the products_model instead of products_name in this part of the code. (highlighted in red)
Code:
$analytics['addProductItemsStr'] .= "ga('ec:addProduct',"
. " { 'id': '{$items_in_cart->fields['products_id']}',"
. " 'name': '".addslashes($items_in_cart->fields['products_name'])."',"
. " 'brand': '{$brandTxt}',"
. " 'category': '".zen_get_categories_name_from_product($items_in_cart->fields['products_id'])."',"
. " 'variant': '{$varTxt}',"
. " 'price': '".number_format($items_in_cart->fields['final_price'] + ($items_in_cart->fields['final_price'] * $items_in_cart->fields['products_tax'] / 100 ),2)."',"
. " 'quantity': '{$items_in_cart->fields['products_quantity']}',"
. " 'coupon': '{$coupon}',"
. " 'position': '{$i}' } );\n";
Some of his model numbers contain dashes "-", underscores "_", ampersands "&", and/or periods ".". Some of his products also contain one or more of these characters along with single quotes and double quotes, and Google seems to accept these characters just fine. Will replacing products_name with products_model be this simple or is there another way to accomplish this without errors??
Bookmarks