我正在帮助客户将其产品放入11街在线购物车中,我面临的问题是要在11街在线购物中插入产品说明。如何在网上购物中放置产品说明。
下面是我的客户公司产品数据库中的产品详细信息,产品详细信息编码元素为“ 描述”,例如“ c8.value AS描述”:
attachment
下面是从客户端数据库编码中获取变量:
<cfhttp result="result" url="https://api.mailgun.net/v3/sandbox0000000000000000000.mailgun.org/messages" method="POST">
<cfhttpparam type="header" name="Authorization" value="Basic #ToBase64("api:***********************************79")#" />
<cfhttpparam type="FORMFIELD" name="from" value="test@gmail.com">
<cfhttpparam type="FORMFIELD" name="to" value="test@test.com">
<cfhttpparam type="FORMFIELD" name="subject" value="attachment test">
<cfhttpparam type="FORMFIELD" name="text" value="Hello">
<cfhttpparam type="formfield" name="html" value="<html>Testing with text/calendar******* type</html>" />
<cfhttpparam type="file" name="attachment" file="#yourattachementfilepath here#" >
</cfhttp>
下面放置变量,并从数据库中调用客户端产品的数据,并将产品数据插入11个街头在线购物中:
<?php
include '../db_config/db_conn.php';
$sql = 'SELECT c1.entity_id AS product_id, c1.sku, c2.value AS prdNm,
c3.value AS product_price,
c5.value AS category_name, c6.value AS weight, c7.value AS image,
c8.value AS description,
c9.value AS price,c11.value AS shipment_type,c12.value AS
warranty,c13.value AS short_description
FROM catalog_product_entity c1
LEFT JOIN catalog_product_entity_varchar c2 ON c1.entity_id=c2.entity_id
AND c2.attribute_id=71
LEFT JOIN catalog_product_entity_decimal c3 ON c1.entity_id=c3.entity_id
AND c3.attribute_id=75
LEFT JOIN catalog_category_product c4 ON c1.entity_id=c4.product_id
LEFT JOIN catalog_category_entity_varchar c5 ON
c5.entity_id=c4.category_id AND c5.attribute_id=41
LEFT JOIN catalog_product_entity_decimal c6 ON c1.entity_id=c6.entity_id
AND c6.attribute_id=80
LEFT JOIN catalog_product_entity_varchar c7 ON c1.entity_id=c7.entity_id
AND c7.attribute_id=85
LEFT JOIN catalog_product_entity_text c8 ON c1.entity_id=c8.entity_id AND
c8.attribute_id=72
LEFT JOIN catalog_product_entity_decimal c9 ON c1.entity_id=c9.entity_id
AND c9.attribute_id=75
LEFT JOIN catalog_product_entity_int c11 ON c1.entity_id=c11.entity_id
AND
c11.attribute_id=127
LEFT JOIN catalog_product_entity_int c12 ON c1.entity_id=c12.entity_id
AND
c12.attribute_id=154
LEFT JOIN catalog_product_entity_text c13 ON c1.entity_id=c13.entity_id
AND c13.attribute_id=73
WHERE c1.entity_id = 190
';
输出如下所示:
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
$product_id = $row['product_id'];
$product_sku = $row['sku'];
$product_name = $row['prdNm'];
$product_price = $row['product_price'];
$product_category_name = $row['category_name'];
$product_weight = $row['weight'];
$product_image = $row['image'];
$product_description = $row['description'];
$product_price = $row['price'];
$product_shipment_type = $row['shipment_type'];
$product_warranty = $row['warranty'];
$product_short_description = $row['short_description'];
}
如果我将(htmlDetail)$ product_description(/ htmlDetail)更改为示例(htmlDetail)-(/ htmlDetail),则该代码有效,但未显示产品说明在11街在线购物网站上。下图显示了11条街道在线购物网站上的输出图片: enter image description here
如果成功插入产品说明,详细信息如下所示:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.11street.my/rest/prodservices/product",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"yes\"?>
<Product>
<selMthdCd>01</selMthdCd>
<dispCtgrNo>4932</dispCtgrNo>
<prdTypCd>01</prdTypCd>
<prdNm>$product_name</prdNm>
<prdStatCd>01</prdStatCd>
<prdWght>$product_weight</prdWght>
<minorSelCnYn>Y</minorSelCnYn>
<prdImage01>$product_image</prdImage01>
<htmlDetail>$product_description</htmlDetail>
<advrtStmt>9789792771251</advrtStmt>
<sellerPrdCd>815210</sellerPrdCd>
<selTermUseYn>N</selTermUseYn>
<selPrc>$product_price</selPrc>
<prdSelQty>9999</prdSelQty>
<cuponcheck>Y</cuponcheck>
<dscAmtPercnt>25</dscAmtPercnt>
<cupnDscMthdCd>01</cupnDscMthdCd>
<cupnIssStartDy>01/05/2019</cupnIssStartDy>
<cupnIssEndDy>30/05/2019</cupnIssEndDy>
<cupnUseLmtDyYn>Y</cupnUseLmtDyYn>
<pointYN>Y</pointYN>
<pointValue>100</pointValue>
<spplWyCd>02</spplWyCd>
我刚刚遇到插入产品说明问题,其他插入产品详细信息应该没问题。希望有人可以帮助我解决这个问题。谢谢。