您的位置:首页 > 编程语言

Bigcommerce:intershop编程经验总结

2013-07-31 16:58 246 查看
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

12. 后台添加一个新的菜单,可以自定义页面

《1》修改 admin->includes->classes->class.auth.php

1)创建后台Product下拉菜单,出现的“View Custom Categories”菜单

查找:else if(is_numeric(isc_strpos($do, "robotstxt"))) {

$GLOBALS['ISC_CLASS_ADMIN_ROBOTSTXT'] = GetClass('ISC_ADMIN_ROBOTSTXT');

$GLOBALS['ISC_CLASS_ADMIN_ROBOTSTXT']->HandleToDo($ToDo);

}

在他后面添加:

else if(is_numeric(isc_strpos($do, "customplugin"))) {

$GLOBALS['ISC_CLASS_ADMIN_ROBOTSTXT'] = GetClass('ISC_ADMIN_CUSTOMPLUGIN');

$GLOBALS['ISC_CLASS_ADMIN_ROBOTSTXT']->HandleToDo($ToDo);

}

《2》修改admin->includes->classes->class.engine.php

查找:array (

'id' => 'SubMenuViewBrands',

'text' => GetLang('ViewBrands'),

'help' => GetLang('ViewBrandsHelp'),

'link' => 'index.php?ToDo=viewBrands',

'show' => $this->auth->HasPermission(AUTH_Manage_Brands),

),

在他后面添加:

array (

'id' => 'SubMenuViewCustomeCategories',

'text' => 'View Custom Categories',

'help' => '',

'link' => 'index.php?ToDo=viewCustomPlugin',

'show' => $this->auth->HasPermission(AUTH_Manage_Brands),

),

数据库关联的表:permissions。要注意查看这张表有没有把刚定义的权限写进去

修改admin->includes->classes->class.user.php

把刚才配置的信息写入:$vendorOnlyPermissions和$vendorAdminPermissions数组里面,这样后台的用户就有权限可以查看他了

13. 优化网站链接

config\config.php里面的优化链接配置:$GLOBALS['ISC_CFG']["EnableSEOUrls"] = 2;

将2改为1:$GLOBALS['ISC_CFG']["EnableSEOUrls"] = 1;

并把根目录下的 .htaccess文件添加301转向配置,就可以进行SEO优化跳转了:

RewriteEngine On

RewriteRule ^网站名称.html$ 网站名称.com/?page_id=$1 [L,NC]

举例:

优化前: products.php?product=Quad-Processeur-LOOP-Système-Couleur-8-Canaux-en-Temps-Réel

优化后:products/Quad-Processeur-LOOP-Système-Couleur-8-Canaux-en-Temps-Réel.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: