运行时sudo apt update,出现以下错误:
Err:4 https://apt.releases.hashicorp.com focal InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AA16FCBCA621E701
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我正在使用以下xml扩展app/code/core/Mage/Page/Block/Html/Topmenu.php:
<config>
<modules>
<Custom_Menu>
<version>1.0</version>
</Custom_Menu>
</modules>
<global>
<blocks>
<page>
<rewrite>
<html_topmenu>Custom_Menu_Block_Page_Html_Topmenu</html_topmenu>
</rewrite>
</page>
</blocks>
</global>
</config>
Run Code Online (Sandbox Code Playgroud)
而我的班级定义:
class Custom_Menu_Block_Page_Html_Topmenu extends Mage_Page_Block_Html_Topmenu
{
}
Run Code Online (Sandbox Code Playgroud)
即使我的类没有覆盖任何方法,以下模板文件也不会被处理:
app/design/frontend/base/default/template/page/html/topmenu.phtml
Run Code Online (Sandbox Code Playgroud)
我没有覆盖模板文件.
一旦我禁用我的模块,它就会重新开始工作.
我是否需要在xml文件中声明其他内容?
我正在使用此方法,因此创建新类别:
private function createCat($name){
$category = Mage::getModel( 'catalog/category' );
$category->setStoreId( 0 );
$category->setName( $name ); // The name of the category
$category->setUrlKey( strtolower($name) ); // The category's URL identifier
$category->setIsActive( 1 ); // Is it enabled?
$category->setIsAnchor( 0 );
// Display mode can be 'PRODUCTS_AND_PAGE', 'PAGE', or 'PRODUCTS'
$category->setDisplayMode( 'PRODUCTS' );
$category->setPath( '1/3' ); // Important you get this right.
$category->setPageTitle( $name );
$category->save();
return $category->getId();
}
Run Code Online (Sandbox Code Playgroud)
在我知道Magento分配给该类别的ID之后,我在循环中调用以下方法为每个类别分配一个父类别:
private function assignCat($id, $parent){
$category = Mage::getModel( 'catalog/category' )->load($id);
$category->setPath( '1/3/'.$parent.'/'.$id ); …Run Code Online (Sandbox Code Playgroud) 我在帮助器中检索产品所属的所有类别ID:
$productCategories = $this->getProduct()->getCategoryIds();
Run Code Online (Sandbox Code Playgroud)
这给了我一组类别ID.就我而言,每个产品只会在一个子类别中.根据ID,我需要根据哪些类别是子项来确定逻辑顺序.
目的是创建一个方法,我可以调用它并指定产品所需的类别级别,它将返回该类别的路径.
我知道我可以像这样加载一个类别:
Mage::getModel('catalog/category')->load($categoryId)
Run Code Online (Sandbox Code Playgroud)
而且我知道我在PHP中做了什么,但只是稍微坚持逻辑(和方法)来实现我想要的东西.