我正在开发一个Spring/Vaadin/Hibernate应用程序.
一切正常但我仍然在Eclipse STS 2.8.1中有以下错误标记:
The hierarchy of the type BankView is inconsistent
The hierarchy of the type AbstractEntityView is inconsistent
Run Code Online (Sandbox Code Playgroud)
我的观点有以下结构:
public class BankView extends AbstractEntityView {
@Resource private BankService bankService;
public void buildLayout() {
super.buildLayout();
// Use of the service here
}
}
public abstract class AbstractEntityView extends AbstractView {
public void buildLayout() {
verticalLayout = new VerticalLayout();
verticalLayout.setSpacing(true);
verticalLayout.setSizeFull();
setContent(verticalLayout);
super.buildLayout();
}
}
@Configurable(preConstruction = true)
public abstract class AbstractView extends com.vaadin.ui.VerticalLayout {
public AbstractView() {
super();
try …Run Code Online (Sandbox Code Playgroud) 我有一个可配置的产品有3个选项,见下文:

我想用产品的实际价格替换+ 24.00英镑和+ 75.00英镑.
所以相反它会说:£69.00和£120.00
我找到了js/varien/product.js中的代码
我花了一些时间来切换和更改代码,但无法完全解读需要更改的内容.此文件中的第240行向下处理可配置产品的JavaScript事件.
我很感激这里有任何帮助.
我创建了一个可配置的产品,它有三个选项:颜色,大小和样式.
现在在产品页面中,每个选项在下拉列表中都有默认文本" 选择一个选项... ",但我希望文本应该是" 选择颜色 "," 选择大小 "和" 选择样式 ".
我在app\code\core\Mage\Catalog\Block\View\Type\Configurable.php中编辑了函数getJsonConfig()
从:
'chooseText' => Mage::helper('catalog')->__('Choose an Option...'),
Run Code Online (Sandbox Code Playgroud)
至:
'chooseText' => ('Select ').$attribute->getLabel(),
Run Code Online (Sandbox Code Playgroud)
并将文件的第39行编辑frontend/base/default/template/catalog/product/view/type/options/configurable.phtml为:
<option><?php echo $this->__('Select ') ?><?php echo $_attribute->getLabel() ?></option>
Run Code Online (Sandbox Code Playgroud)
但结果并不好,它总是在三个选项中显示文字"选择风格".请给我一个这个问题的提示,非常感谢你!
使用AspectJ时,为什么要在@Configurable上使用@Component.
我有@Transactional支持的Spring和AspectJ设置,自我调用的方面以及注入JPA实体.这非常有效.
我正在将@Component用于大多数需要注入的类,因此要么将它们注入到它们的依赖项中.或者,当我不能,注入ApplicationContext然后使用getBean()作为最后的手段.我只为需要注入的JPA实体(Hibernate)保留@Configurable.我也开始使用@Configurable进行jUnit测试,使编写测试变得容易.这也很有效.
但我很好奇.如果AspectJ现在使用@Configurable注释自动注入(bean化)任何东西,无论它是如何构造的; getBean(),new(),@ Autowired.为什么我不能只为我的所有bean切换到使用@Configurable?然后我可以完全取消应用程序上下文和getBean(),只需要new()我无法注入的任何类.
我意识到我没有提到XML bean配置.我并不回避这一点,但这个项目并不需要任何.我只是构造函数或setter在测试时注入依赖项.很容易.
情况就是这样:
我有一个可配置的产品,有几个简单的产品.这些简单的产品需要与可配置产品具有相同的产品图像.目前,我必须一遍又一遍地将相同的图像上传到每个简单的产品.
有没有办法将可配置产品的产品图像链接到简单的产品?
我的一些产品在一个可配置的产品中有30个简单的产品,上传相同的图像30次是太过分/烦人.
我希望有人可以帮我解决这个问题!
提前致谢!
我们希望通过另一个系统中的Magento-API导出/导入可配置产品.对我们来说重要的是可配置产品的价值,如T恤,有3种颜色(红色,绿色和蓝色).
我们使用以下函数接收可配置属性:
public function options($productId, $store = null, $identifierType = null)
{
$product = $this->_getProduct($productId, $store, $identifierType);
if (!$product->getId()) {
$this->_fault('not_exists');
}
$configurableAttributeCollection = $product->getTypeInstance()->getConfigurableAttributes();
$result = array();
foreach($configurableAttributeCollection as $attribute){
$result[$attribute->getProductAttribute()->getAttributeCode()] = $attribute->getProductAttribute()->getFrontend()->getLabel();
//Attr-Code: $attribute->getProductAttribute()->getAttributeCode()
//Attr-Label: $attribute->getProductAttribute()->getFrontend()->getLabel()
//Attr-Id: $attribute->getProductAttribute()->getId()
}
return $result;
}
Run Code Online (Sandbox Code Playgroud)
但是如何使用我们通过上述函数获得的可配置属性中的现有标签/ id来获取该产品中使用的选项(如果可配置属性为"颜色",则为蓝色,绿色,红色)?
答案非常感谢!
蒂姆
我正在尝试以编程方式将一些现有的简单产品加入到现有的可配置产品中.
我几乎没有找到任何关于此的提示/文档.我检查了MAGMI Magento Mass Importer插件(特别是magmi_productimportengine.php-file)但没有成功.
之后我找到了这个片段:
function attachProductToConfigurable($childProduct, $configurableProduct)
{
$loader = Mage::getResourceModel('catalog/product_type_configurable')
->load($configurableProduct, $configurableProduct->getId());
$ids = $configurableProduct
->getTypeInstance()
->getUsedProductIds();
$newids = array();
foreach ($ids as $id) {
$newids[$id] = 1;
}
$newids[$childProduct->getId()] = 1;
//$loader->saveProducts( $_configurableProduct->getid(), array_keys( $newids ) );
$loader->saveProducts($configurableProduct, array_keys($newids));
}
Run Code Online (Sandbox Code Playgroud)
但是当我试图像这样调用函数时:
$sProduct = Mage::getModel('catalog/product')
->loadByAttribute('sku', $v);
$cProduct = Mage::getModel('catalog/product')
->loadByAttribute('sku', $sku);
attachProductToConfigurable($sProduct, $cProduct);
Run Code Online (Sandbox Code Playgroud)
(每个简单的产品SKU一步一步地传递给可配置的产品)
Fatal error: Call to a member function getId() on a non-object in ... on line 1018
这是函数本身的这一行
$loader = Mage::getResourceModel('catalog/product_type_configurable') …Run Code Online (Sandbox Code Playgroud) 我正在开发一种软件产品,可以根据提供的配置和元数据显着改变行为.
我想知道构建/构建高度可配置的软件产品的最佳实践.考虑到有大量的配置参数,我想在看一下依赖注入之前先看一下不会影响性能的东西.我的平台是.Net ......我寻求有关架构/设计和实现前端的建议.
我需要将可配置产品的选项显示为div,并在其中带有“ a”,以便用户在选项中单击并选择它,而不是下拉列表。就像菜单一样(目标是显示鞋子的尺码)。
众所周知,Magento使用Json响应来填充下拉菜单的选项。(var spConfig = new Product.Config(getJsonConfig()?>),并且该类位于js / varien / product.js(Product.Config = Class.create())中。
然后,我要做的是编辑文件template / catalog / product / view / type / options / configurable.phtml并将类似的原始行为替换。
'<?php
echo '
<ul class="super-attribute-select">';
$resultado = json_decode($this->getJsonConfig(), true);
$atributo=$resultado['attributes'][162]['options'];
foreach($atributo as $att){
echo '<li>';
echo '<a value="'.$att['id'].'" price="'.$att['price'].'" href="javascript:void()" onclick="return assignValue()">'.$att['label'].'</a>';
echo '</li>';
}
echo ' </ul>
<div class="clear"></div>';
?>'
Run Code Online (Sandbox Code Playgroud)
这个简单的模块让我替换了由div组成的小网格的菜单。现在,我正在尝试制作一个模仿本机行为的Javascript函数,但仅针对所选选项(在本例中为鞋码)。据我了解,代码通过表单发送选项值,所以我的想法是创建一个隐藏的输入,然后在用户单击时通过Javascript函数分配该值,如下所示:
'<script>
function assignValue(value){
//assign the value
document.getElementById('super_attribute[162]').value = value;
//mod the class of the selected item
this.addClassName("selected");
</script>'
Run Code Online (Sandbox Code Playgroud)
我认为可能有必要创建一个函数或调用一个方法,使magento已经必须获得所需的值。甚至我都不知道在隐藏的输入上设置类“ required-entry”是否是一个好主意。
请问你能帮帮我吗?任何帮助或其他想法将不胜感激。
我想要一个简单的方法让我的用户在购买前选择服装尺寸,但可配置产品似乎有点过分.你必须制作各种尺寸的产品,然后你必须制作一个可配置的产品.
这家商店是给我爸爸的,如果我必须向他解释他将如何做到这一点,他将需要几个星期的时间来了解这一点,(花了几天的时间让他学会创造一个简单的产品)
是否有任何其他可能性来创建产品,并在前端让用户选择大小属性..
必须有一个比这更简单的方法吗?
configurable ×10
magento ×7
product ×4
php ×3
spring ×2
annotations ×1
aop ×1
api ×1
attributes ×1
behavior ×1
eclipse ×1
hierarchy ×1
image ×1
import ×1
javascript ×1
join ×1
metadata ×1
options ×1
prototypejs ×1
spring-aop ×1
vaadin ×1