nopcommerce 去掉blog的正文
将下面这段代码注释掉,路径
theme\customeMicroAnalytix\views\blog\list.cshtml
<div class="post-body">
@Html.Raw(item.Body)
</div>
this is a JS world
将下面这段代码注释掉,路径
theme\customeMicroAnalytix\views\blog\list.cshtml
<div class="post-body">
@Html.Raw(item.Body)
</div>
由于修改了full text 编辑器的URL设定,导致部分token无法正常使用,需要将
<a href="/Admin/MessageTemplate/Edit/%Store.URL%">%Store.Name%</a>
中的/Admin/MessageTemplate/Edit/部分去除
Errno 22] invalid mode (‘r’) or filename:
这种错误的出现是在使用built-in函数file()或者open()的时候。或者是因为文件的打开模式不对,或者是文件名有问题。前者的话只需要注意文件是否可读或者可写就可以了。后者则是与文件路径相关的问题,需要在文件名前加r或者R转义,如:file(r”e:\Test.txt”,’r’).或者将反斜杠\变成两个,如file(“e:\Test.txt”,’r’).
注意事项,%d 占位符是整数型, %s占位符是字符串
#主方法
def process():
#读取csv,转换成list 更改文件存储位置
reader = list(csv.reader(open("D:\\ski\\attribute\\attribute-gc.csv")))
header = reader[0]
#遍历数据,并处理, tips:跳过第一行
for i in reader[1:]:
sku = i[0]
product_id = getIdFromSku(sku)
if product_id == 0:
print "error sku %s" % sku
continue
optionname = i[1]
print optionname
#测试看是否存在这样的optionname
test(optionname)
#如果存在,取optionid
optionid = getoptionIdFromoption(optionname)
print optionid
#插入optionid和productid
if exist(product_id,optionid):
print "exist"
pass
else:
insert(product_id,optionid)
#是否存在productid和optionid,如果存在,就退出
def exist(product_id,optionid):
sql = "select * from dbo.Product_SpecificationAttribute_Mapping where ProductId = %d and SpecificationAttributeOptionId = %d" % (product_id,optionid)
cursor.execute(sql)
rows = cursor.fetchall()
if len(rows)==0:
return False
else:
return True
#通过optionname找出optionid
def getoptionIdFromoption(optionname):
sql="SELECT Id FROM dbo.SpecificationAttributeOption where SpecificationAttributeId=%d and Name='%s'" % (12,optionname)
print sql
cursor.execute(sql)
row = cursor.fetchall()
return row[0][0]
插入optionid和productid
def insert(product_id,optionid):
sql = "insert into dbo.Product_SpecificationAttribute_Mapping(ProductId,SpecificationAttributeOptionId,DisplayOrder,AllowFiltering,ShowOnProductPage) values(%d,%d,%d,%d,%d)" % (product_id,optionid,0,0,1)
print sql
cursor.execute(sql)
cnxn.commit()
#通过sku找出id
def getIdFromSku(a):
sql = "select Id from dbo.Product where Sku='%s' and deleted=0" % a
cursor.execute(sql)
row = cursor.fetchall()
if row:
return row[0][0]
else:
return 0
#测试optionname是否存在,若不存在,则插入
def test(optionname):
if find(optionname) == 0:
sql="insert into dbo.SpecificationAttributeOption (Name,SpecificationAttributeId,DisplayOrder) values('%s',12,0)" % optionname
print sql
cursor.execute(sql)
cnxn.commit()
#测试optionname是否存在,若不存在,则插入
def find(optionname):
sql="SELECT Id FROM dbo.SpecificationAttributeOption where SpecificationAttributeId=%d and Name='%s'" % (12,optionname)
cursor.execute(sql)
row = cursor.fetchall()
if row:
return row[0][0]
else:
return 0
if __name__ == "__main__":
process()
the width and height is decided by the size of photo.
now changing from 690467 to 690265
if we want to change the speed of the animation
go to plugins\widgets.novoslider\scrpts\jquery.nivo.slider.js
change
//Default settings
$.fn.nivoSlider.defaults = {
effect: 'random',
slices: 15,
boxCols: 8,
boxRows: 4,
animSpeed: 500,
pauseTime: 3000,
startSlide: 0,
directionNav: true,
controlNav: true,
controlNavThumbs: false,
pauseOnHover: true,
manualAdvance: false,
prevText: 'Prev',
nextText: 'Next',
randomStart: false,
beforeChange: function () { },
afterChange: function () { },
slideshowEnd: function () { },
lastSlide: function () { },
afterLoad: function () { }
};
go to the path
theme\customemicroanalytix\views\catalog\topmenu.cshtml
@if (Model.BlogEnabled)
{
<li><a href="@Url.RouteUrl("Blog")">APPLICATIONS & TECHNOLOGIES</a></li>
}
here, we will change APPLICATIONS to APPLICATIONS & TECHNOLOGIES
change the
@{
Layout = "~/Views/Shared/_ColumnsThree.cshtml";
}
generate
{
<div class="product-picture">
<a href="@Url.RouteUrl("Product", new { SeName = product.SeName })" title="@product.DefaultPictureModel.Title">
<img class="recentviewimg"alt="@product.DefaultPictureModel.AlternateText" src="@product.DefaultPictureModel.ImageUrl" title="@product.DefaultPictureModel.Title" />
</a>
</div>
}
to
{
<div class="product-picture">
<a href="@Url.RouteUrl("Product", new { SeName = product.SeName })" title="@product.DefaultPictureModel.Title">
<img class="recentviewimg"alt="@product.DefaultPictureModel.AlternateText" src="@product.DefaultPictureModel.FullSizeImageUrl" title="@product.DefaultPictureModel.Title" />
</a>
</div>
}
the reason is:
if we choose imageUrl,it will load image from thumb but if we choose Fullsizeimageurl,then it will load from full size.
___could be found in nop.web\controllers\catalogcontroller.cs like this below:
var defaultPictureModel = new PictureModel()
{
ImageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), defaultPictureSize, !isAssociatedProduct),
FullSizeImageUrl = _pictureService.GetPictureUrl(pictures.FirstOrDefault(), 0, !isAssociatedProduct),
Title = string.Format(_localizationService.GetResource("Media.Product.ImageLinkTitleFormat.Details"), model.Name),
AlternateText = string.Format(_localizationService.GetResource("Media.Product.ImageAlternateTextFormat.Details"), model.Name),
};
add css for the size of image
class=”recentviewimg”
and add css in theme
.block-recently-viewed-products li {
background: none;
height: 55px;
clear: both;
margin:0px;
border-bottom: 1px solid #e5e5e5;
}
.block-recently-viewed-products li.last {
border-bottom: none;
}
.block-recently-viewed-products .product-picture {
float: left;
height: 55px;
width: 55px;
margin: 0px;
padding:0px;
}
.recentviewimg
{
float: left;
height: 50px;
width: 50px;
margin-right: 5px;
padding:0px;
}