Php 从下拉列表中选择类别时是否显示相关属性?
我想根据下拉列表中的选择显示属性。为此,我编写了一些代码,在localout的Magento中工作正常,现在我想在Magento中工作……我使用的是Magento CE 1.7 这是我的代码外面的magento代码 本地代码:-Php 从下拉列表中选择类别时是否显示相关属性?,php,javascript,jquery,ajax,magento-1.7,Php,Javascript,Jquery,Ajax,Magento 1.7,我想根据下拉列表中的选择显示属性。为此,我编写了一些代码,在localout的Magento中工作正常,现在我想在Magento中工作……我使用的是Magento CE 1.7 这是我的代码外面的magento代码 本地代码:- <html> <head> <title></title> </head> <body> <select id="xyz">
<html>
<head>
<title></title>
</head>
<body>
<select id="xyz">
<option value="Men">Men</option>
<option value="Women">Women</option>
<option value="Kids">Kids</option>
<option value="Furniture">Furniture</option>
<option value="Books">Books</option>
</select>
<div id="Men" class="group">
Color<input id="color" name="color" type="text">
Size<input id="size" name="size" type="text">
</div>
<div id="Women" class="group">
Size<input id="size" name="size" type="text">
</div>
<div id="Kids" class="group">
Color<input id="color" name="color" type="text">
</div>
<div id="Furniture" class="group">
Color<input id="color" name="color" type="text">
Size<input id="size" name="size" type="text">
Finishing<input id="finishing" name="finishing">
</div>
<div id="Books" class="group">
ISBN<input id="isbn" name="isbn" type="text">
</div>
</body>
<script language="JavaScript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function () {
$('.group').hide();
$('#Men').show();
$('#xyz').change(function () {
$('.group').hide();
$('#'+$(this).val()).show();
})
});
</script>
</script>
</html>
是的,现在我想在magento下拉列表类别中应用相同的东西,我写了这段代码,但它不起作用为什么?我做错什么了吗
Magento代码:-
<tr>
<td class="tdpadfirst">
<label for="category" class="rightgap"><?php echo Mage::helper('marketplacepartner')->__('Product Category') ?>:</label><span class="required starimp"> </span>
</td>
<td class="tdpadsec">
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
<select id="xyz" class="myinput-text required-entry widthinput" name="category">
<option value="">--Select Categories--</option>
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<element onclick="<?php $currentCategory = Mage::registry('current_category') ?>">
<?php if (count($_categories) > 0): ?>
<?php foreach($_categories as $_category): ?>
<option value="<?php echo $_category->getId() ?>">
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
<?php echo $_category->getName() ?></a>
</option>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
</td>
这里我使用的是Magento CE 1.7
有什么想法吗?看来你的布局很笨拙
<div id="Kids" class="group">
<tr>
<td class="tdpadfirst">
<label for="seller_colour" class="rightgap"><?php echo Mage::helper('marketplacepartner')->__('Color') ?> :</label><span class="required starimp"> </span>
</td>
<td class="tdpadsec">
<input type="seller_colour" class="required-entry widthinput" name="seller_colour" id="seller_colour" value="<?php echo $seller_colour ?>"/>
<?php echo Mage::helper('marketplacepartner')->__('For multiple values separate with , (Example: White,Black) ') ?>
</td>
</tr>
</div>
我不知道如何将它们放入标签?中,请在div结构中重新组织它们
<table>
<tr><td>
your category divs
</td>
</tr>
</table>
在我的Magento网站中,我只有4个类别,分别是男性、女性、儿童、家具……任何人都可以帮助我,请对我非常重要……谢谢
<table>
<tr><td>
your category divs
</td>
</tr>
</table>