Bunny's Code Burrow

this is a JS world


  • Home

  • About

  • Archives

  • Tags

  • Search

nopcommerce blog

Posted on 2017-04-24

nopcommerce 去掉blog的正文

将下面这段代码注释掉,路径

theme\customeMicroAnalytix\views\blog\list.cshtml

<div class="post-body">
    @Html.Raw(item.Body)
</div>

message template

Posted on 2017-04-24

message template的token修改

由于修改了full text 编辑器的URL设定,导致部分token无法正常使用,需要将

<a href="/Admin/MessageTemplate/Edit/%Store.URL%">%Store.Name%</a>

中的/Admin/MessageTemplate/Edit/部分去除

excel

Posted on 2017-04-24

【Excel技巧】空单元格自动填充上一单元格内容

  1. 使用“定位”命令来快速查找和选择所有包含特定类型数据(例如公式)的单元格或者只是符合特定条件的单元格.
    操作:在“开始”选项卡上的“编辑”组中,单击“查找和选择”,然后单击“定位”(或转到)。键盘快捷方式 也可以按 Ctrl+G,按 F5 也会显示此对话框。
  2. 按 Ctrl+Enter 可使用当前条目填充选定的单元格区域,也就是说在非连续的单元格内批量填充相同内容。

some points in Python

Posted on 2017-04-24

Python points

Errno 22] invalid mode (‘r’) or filename:
这种错误的出现是在使用built-in函数file()或者open()的时候。或者是因为文件的打开模式不对,或者是文件名有问题。前者的话只需要注意文件是否可读或者可写就可以了。后者则是与文件路径相关的问题,需要在文件名前加r或者R转义,如:file(r”e:\Test.txt”,’r’).或者将反斜杠\变成两个,如file(“e:\Test.txt”,’r’).

add special attribute massive

Posted on 2017-04-24

add special attribute massive

注意事项,%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()

INFO Generated: lib/jquery_lazyload/bower.json

Posted on 2017-04-24

change the banner for nop

Posted on 2017-04-24

change the banner for nop

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 () { }
};

navigation nopcommerce

Posted on 2017-04-24

How to change the navigation bar in nop

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 homepage layout

Posted on 2017-04-24

how to update nopcommerce homepage layout

  1. find this file under the themes/themesname/views/home/index.cshtml
  2. change the

    @{
        Layout = "~/Views/Shared/_ColumnsThree.cshtml";
    }
    
  3. generate

  4. refresh

size of image under recently review

Posted on 2017-04-24

how to change the size of image under recently review nopcommerce

  1. go to nop.web\views\catalog\recentlyviewproductblock.cshtml
  2. change the following code
  3. {
        <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),
       };
  1. 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;
    

    }

1…121314…16
Jenny Zeng

Jenny Zeng

Loving code ,especially javascript, React Native

155 posts
37 tags
GitHub Linkedin
© 2020 Jenny Zeng
Powered by Hexo
Theme - NexT.Pisces