-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.8.6
-- PHP version -- : 7.1.15
-- Browser(s) name and version -- : Firefox Developer Edition
-- Error-message(debug-mod must be tuned on) -- : No error message.
Hi,
I'm try to change the product ID to product name in HikaShop. The product ID we getting by calling from the custom script.
Here is the part to calling the product ID.
function getCharityNeed(generateID){
jQuery.ajax({
type: "GET",
url: "http://ayambrand-com-my-v1.cloudaccess.host/administrator/index.php?option=com_echarity&format=raw&task=api.get_need&charity_id=" + generateID,
success: function (data){
var ac = JSON.parse(data);
var remaining_quota='';
var product_id='';
var quota = '';
jQuery.each(ac, function(index, value) {
jQuery.each(value.unmet_quotas, function(subindex, subvalue) {
jQuery.each(subvalue, function(subsubindex, subsubvalue){
remaining_quota = subvalue.remaining_quota;
product_id = subvalue.product_id;
quota = subvalue.quota;
console.log('Product ID : ' + product_id +' Quota : ' + quota + ' Remaining Quota : ' + remaining_quota);
jQuery.ajax({
type: "POST",
url: "/administrator/custom/get_products.php",
data: {productPost: product_id},
success: function(data) {
console.log(data);
jQuery("#contentNeed").html('<ul><li>'+data+'</li></ul>');
}
});
return false;
});
});
});
}
});
jQuery(".pTitles").load( "/index.php?option=com_content&view=article&id="+ generateArticleID + " #title-charity h2" );
}
The other part is the php file where we pass the variable to php and trying to convert the ID to the product name.
<?php
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){
return false;
}
if(isset($_POST['productPost'])){
$productClass = hikashop_get('class.product');
$productID = $_POST['productPost'];
$product=$productClass->get($productID);
echo "Product ID : " + $product;
}
?>
But the issue is it not return any results to the main page. But if i remove all the php/hikashop script it return something on the main page.
Can you help me to configure it.
Thans in advnces.