我正在帮助客户将产品放置在11街在线购物车上,但是当我成功在11街在线购物页面上插入product_short_description
时遇到了一个问题-它向我显示了字符串结合在一起。如何使product_short_description
的字符串显示在两行上,一行在另一行之上?
我的代码如下所示:
<?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'];
}
';
//removed "br" tag, because if I don't remove "br", it will show me error//
$product_short_description = strip_tags($product_short_description);
$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_short_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>13/08/2014</cupnIssStartDy>
<cupnIssEndDy>20/08/2014</cupnIssEndDy>
<cupnUseLmtDyYn>Y</cupnUseLmtDyYn>
<pointYN>Y</pointYN>
<pointValue>100</pointValue>
<spplWyCd>02</spplWyCd>
<selMinLimitQty>3</selMinLimitQty>
<selMinLimitTypCd>01</selMinLimitTypCd>
<selLimitQty>10</selLimitQty>
<selLimitTypCd>02</selLimitTypCd>
<asDetail>-</asDetail>
<dlvMthCd>01</dlvMthCd>
<dlvCstInstBasiCd>01</dlvCstInstBasiCd>
<width>10</width>
<length>12</length>
<height>13</height>
<packageWidth>10</packageWidth>
<packageLength>12</packageLength>
<packageHeight>13</packageHeight>
<rtngExchDetail>test sample</rtngExchDetail>
<suplDtyfrPrdClfCd>04</suplDtyfrPrdClfCd>
<suplDtyfrPrdClfRate>2.56</suplDtyfrPrdClfRate>
<productAttributes>
<attribute>
<attributeCode>2000005</attributeCode>
<attributeName>Brand</attributeName>
<attributeNo>174034</attributeNo>
<attributeValueList>
<attributeValue>CHANEL</attributeValue>
<attributeValueCode>2010498</attributeValueCode>
<attributeValueNo>174034</attributeValueNo>
</attributeValueList>
</attribute>
<attribute>
<attributeCode>2009110</attributeCode>
<attributeName>All</attributeName>
<attributeNo>174152</attributeNo>
<attributeValueList>
<attributeValue>Female</attributeValue>
<attributeValueCode>2010761</attributeValueCode>
<attributeValueNo>174152</attributeValueNo>
</attributeValueList>
</attribute>
</productAttributes>
<warrantyType>1</warrantyType>
<warrantyPeriod>1</warrantyPeriod>
<packageWeight>1</packageWeight>
<productFeatures>feature - 1</productFeatures>
<productFeatures>feature - 2</productFeatures>
</Product>",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/xml",
"openapikey: sadqwd124312qwrfw353",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
echo $response;
只是“ html details”元素有问题,因为在购物网站上,product_short_description
的两个字符串显示在同一行上,如下图所示:
enter image description here
我想要的是让product_short_description
的输出将字符串分开并显示在两行上,其中一行在另一行上方,例如此处的图像:
enter image description here
希望有人可以帮助我在简短的产品说明中分隔字符串。谢谢。