简体   繁体   English

如何在Magento商店的首页上更改代码?

[英]How to change code on the front page of a Magento store?

I am helping out with a Magento store initially configured by another developer who is now gone from the company, and I have no experience using Magento at all. 我正在为最初由另一位开发人员配置的Magento商店提供帮助,该开发人员现在已经离开公司,而我完全没有使用Magento的经验。 Instead of using the built-in newsletter tools, he created an HTML form which points to a completely different server (which he owns) and now we no longer get notifications when a customer signs up for it. 他没有使用内置的新闻通讯工具,而是创建了一个HTML表单,该表单指向一个完全不同的服务器(由他拥有),现在当客户注册时,我们不再收到通知。

Somehow, he embedded the HTML into the front page of the Store's website. 他以某种方式将HTML嵌入到商店网站的首页中。 I spent hours looking for the HTML and did find it, in a page called "Subscribe.phtml". 我花了几个小时寻找HTML,并在名为“ Subscribe.phtml”的页面中找到了它。 I got happy, changed the code inside that page to what I want it to be, uploaded it back to the server and... nothing. 我很高兴,将页面内的代码更改为我想要的代码,将其上传回服务器,然后……什么都没有。 No change at all to the site. 该站点没有任何变化。 I flushed the cache but that did not help. 我刷新了缓存,但没有帮助。

The page does not appear to have much code in it. 该页面似乎没有太多代码。 In CMS->Pages->Content, it shows only this: 在CMS->页面->内容中,它仅显示以下内容:

{{block type="featuredproductslider/featuredproductslider" name="featuredproductslider"
template="magentothem/featuredproductslider/featuredproductslider.phtml"}}{{block 
type="newproduct/newproduct" name="newproduct" 
template="magentothem/newproduct/newproduct.phtml"}}

Under Design, it shows only that the layout is "3 columns". 在设计下,它仅显示布局为“ 3列”。 There is literally nothing else in this section. 实际上,本节中没有其他内容。

Can you help me understand how I can change the HTML in this area to make this work? 您能帮助我了解如何更改此区域中的HTML以使其正常工作吗? If this is helpful, here's a picture of the area that I am trying to configure: 如果这有帮助,那么这是我尝试配置的区域的图片:

在此处输入图片说明

Thank you. 谢谢。

On page 44 of the manual , there's a section called "How to find out which layout file to modify". 手册的第44页上,有一个小节“如何找出要修改的布局文件”。 I used Template Hints and figured out where the code lived. 我使用了模板提示,并找出了代码所在的位置。 This is what Jim was referring to. 这就是吉姆指的。 It would have been nice for someone to instruct me on how to do this. 有人指导我如何做到这一点真是太好了。

I set it up and found that the previous developer had modified the template directly rather than use blocks or other parts built-in to the system to modify the front page. 我进行了设置,发现以前的开发人员直接修改了模板,而不是使用系统内置的模块或其他部件来修改首页。

You can enable template hints in the Magento configuration: 您可以在Magento配置中启用模板提示:

  1. Go to System->Configuration 转到系统->配置
  2. Change "Current Configuration Scope" to "Main Website" 将“当前配置范围”更改为“主网站”
  3. Go to Advanced->Developer 转到高级->开发人员
  4. Under the Debug tab, choose "Yes" for the "Template Path Hints" 在“调试”标签下,为“模板路径提示”选择“是”
  5. Save configuration. 保存配置。

Now go to your homepage, refresh the page and you will see paths to all templates used on the homepage. 现在转到您的主页,刷新页面,您将看到该主页上使用的所有模板的路径。 You will then get a good idea of where each block comes from. 然后,您将很好地了解每个块的来源。

It won't solve your problem, but it might help you find the right template to edit. 它不能解决您的问题,但是可以帮助您找到合适的模板进行编辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM