Bigcommerce:intershop编程经验总结

1.修改或者添加网页Title,Keywords,Decoration的代码:

$full_url = $_SERVER['REQUEST_URI'];  //获取请求的url
$letter = substr($full_url,strrpos($full_url,"/")+1);//获取最后一个‘/’号后面的字符内容
$letter = urldecode($letter);  //还原URL 编码字符串
      
if($letter =='hotsales')
{
  $canonicalLink = GetConfig('ShopPathNormal').'/'.$letter;  //securitycamera2000.com/hotsales
}else{
  $canonicalLink = GetConfig('ShopPathNormal').'/hotsales/'.$letter;  //securitycamera2000.com/hotsales/A
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetCanonicalLink($canonicalLink);   //设置canonical<link rel='canonical'  href='http://www.网址/hotsales' />


if(strlen($letter)>3 and $letter!='hotsales')
{
 $letter=str_replace('-',' ',$letter);
 $des= 'Professional '.$letter.' Wholesale. FREE shipping, 1 Year Warranty, 30 Days Money Back Guarantee - !';
}else{
 $des= 'Professional '.$letter.' Wholesale. FREE shipping, 1 Year Warranty, 30 Days Money Back Guarantee - ';
}


2.产品列表的图片默认用主图
要在where条件后面添加代码:and b.imageisthumb = 1

例如:
$prodQuery= mysql_query("select a.prodname,a.prodprice,a.prodvariationid,a.prodeventdaterequired, a.prodconfigfields , FLOOR
(a.prodratingtotal/a.prodnumratings) AS prodavgrating, b.imagefilethumb from isc_products a, isc_product_images b where a.productid=". $productId." and b.imageisthumb = 1 and b.imageprodid=".$productId) or die(mysql_error());



3.所有数据库的操作

1)查找一条记录:
$qProd1 = "SELECT  COUNT(tagid) FROM [|PREFIX|]product_tagassociations WHERE productid='".$prodIDs."'";
$rowCount = $GLOBALS['ISC_CLASS_DB']->FetchOne($qProd1);

echo $rowCount;


2) 更新语句
$qProd1 = "SELECT  COUNT(productid) FROM [|PREFIX|]product_tagassociations WHERE tagid='".$tagsID."'";
$rowCount = $GLOBALS['ISC_CLASS_DB']->FetchOne($qProd1);
//echo $rowCount;

 $updatedCategory = array(
"tagcount" => $rowCount
);
$GLOBALS['ISC_CLASS_DB']->UpdateQuery("product_tags", $updatedCategory, "tagid='".$tagsID."'");


3)删除语句
mysql_query("delete from isc_custom_categories where id IN (".$catIds.") or parentid IN (".$catIds.")" ) ;


4)查找所有的循环数据
$query = "SELECT o.*
FROM [|PREFIX|]order_configurable_fields o
JOIN [|PREFIX|]product_configurable_fields p ON o.fieldid = p.productfieldid
WHERE
o.orderid=".(int)$orderId."
ORDER BY p.fieldsortorder ASC";


$result = $GLOBALS['ISC_CLASS_DB']->Query($query);


$fields = array();

while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$fields[$row['ordprodid']][] = $row;
}


5)增加语句
$query = "INSERT INTO `[|PREFIX|]keystore` (`key`, `value`) VALUES ('" . $this->db->Quote($key) . "', '" . $value . "') ON DUPLICATE KEY 


UPDATE `value` = CAST(`value` AS SIGNED) + VALUES(`value`)";
$result = $this->db->Query($query);
if (!$result) {
throw new Interspire_KeyStore_Exception($this->db->GetErrorMsg());
}


6.调用另一个类的某个方法
(1)$relatedProducts = $GLOBALS['ISC_CLASS_PRODUCT']->GetRelatedProducts();


(2)if ($GLOBALS["ISC_CLASS_SEARCH"]->GetNumResults("product") > 0) {
$productSearchResults = ISC_PRODUCT::buildSearchResultsHTML();
}




4.URL编码转换
$proURL=$row['prodname'];  
  $proURL=str_replace("/","{47}",$proURL);   //把/号转换成{47}
  $PURL=str_replace("-","%252d",$proURL); 
  $PURL=str_replace(" ","-",$PURL);  
  $PURL=str_replace("+","%252b",$proURL);
  

5.给产品名称添加Link地址
$GLOBALS['ItemNameLink'] = prodLink(isc_html_escape($prod_row['ordprodname']));   //used prodLink()


6. 后台模板更改后显示有问题的原因
在DW中打开,观察代码的颜色,把不正确颜色的代码改过来。还有模板文件中不能有空行


7.数据库表中的时间,经常是一串数字,比如:1138618081
解析:是用time() 函数返回当前时间的 Unix 时间戳。
<?php
$t=time();
echo($t . "<br />");
echo(date("D F d Y",$t));
?>
输出:
1138618081
Mon January 30 2006


8.页面加载的时间:出现500错误
bigcommerce系统页面的加载时间是有限制的,这跟php服务器的配置有关系


9.邮件服务器——邮件里面的产品带有特殊字符:双引号和&符号,邮箱里面的URL会转码错误!需要修改为:
$proURL=ProdLink(isc_html_escape($product_row1['ordprodname']));
$proURL=str_replace("%26%23039%3B%26%23039%3B","%27%27",$proURL);  //这个是双引号的替换

$proURL=str_replace("%26amp%3B","%26",$proURL);  //这个是&符号的替换


10. 后台Store Design,如果在ftp删掉不需要的模板主题文件夹,后台Store Design会出错。需要注意:必须保留__mobile、__master(这个是母文件)、__logos、__includes、__gift_themes、__emails(这个是Bigcommerce系统所有发送出去的邮件的主题文件夹)


11.Bigcommerce系统所有URL后面带?然后后面是一串字符,如果在搜索引擎里面有很多这样的网页,点击进入站点,在站点里是不存在这样的页面,系统将全部转到带?前面的URL的当前页面。

可以用: <linkrel='canonical' href='' /> canonical属性指定为唯一页面,这样有利于SEO

原文地址:https://www.cnblogs.com/dyllove98/p/3228517.html