2015-12-19 43 views
0

我試圖更改主頁產品列表。 所以我想重寫文件路徑:Solidus/Spree覆蓋不起作用

https://github.com/solidusio/solidus/blob/master/frontend/app/views/spree/shared/_products.html.erb

Deface::Override.new(:virtual_path => 'spree/shared/products', 
       :replace_contents => "li#product_", 
       :name => "product_new", 
       :text => "text") 

然而這段代碼的網頁上絕對0的變化。

該文件將在此覆蓋在被​​稱爲product_override.rb並在app /覆蓋

任何幫助,將不勝感激。 謝謝

回答

1

我已經用Solidus的新安裝測試了這個代碼,它工作。 請注意,我在:virtual_path => 'spree/shared/_products'的「產品」之前添加了下劃線。另外,我將選擇器更改爲「li」。

Deface::Override.new(:virtual_path => 'spree/shared/_products', 
      :insert_after => "li", 
      :name => "product_new", 
      :text => "Override is working")