我有这个脚本来显示选择选项的动态sku,但我无法工作.
正在加载正确的sku,但在选择时没有任何事情发生.
此代码获取Javascript上的sku列表,并在可配置产品视图上更新产品选择选项的div.
<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl>
<?php foreach($_attributes as $_attribute): ?>
<dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
<dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
<div class="input-box">
<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select" onchange="return changeSku(this);">
<option><?php echo $this->__('Choose an Option...') ?></option>
</select>
</div>
</dd>
<?php endforeach; ?>
</dl>
<script type="text/javascript">
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
</script>
<?php endif;?>
<?php
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$col = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions(); …Run Code Online (Sandbox Code Playgroud) 需要添加额外的行以跳过带有csv文件头的第一行.但我不知道从哪里开始.
<?php
if(isset($_POST["submit"]))
{
$host="localhost"; // Host name.
$db_user="root"; //mysql user
$db_password=""; //mysql pass
$db='local'; // Database name.
$conn=mysql_connect($host,$db_user,$db_password) or die (mysql_error());
mysql_select_db($db) or die (mysql_error());
echo $filename=$_FILES["file"]["name"];
$ext=substr($filename,strrpos($filename,"."),(strlen($filename)-strrpos($filename,".")));
$file = fopen($filename, "r");
$handle = fopen("$filename", "r");
while (($data = fgetcsv($handle, 100000, ",")) !== FALSE)
{
$import="INSERT into customers(fname,lname,company,address,city,state,country,postal_code,phone,email) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]')";
mysql_query($import) or die(mysql_error());
}
fclose($handle);
print "Import done";
}
else
{
print "<form enctype='multipart/form-data' method='post'>";
print "Type file name to import:";
print "<input type='file' name='file' id='file'>";
print "<input type='submit' name='submit' …Run Code Online (Sandbox Code Playgroud) 我的代码有一个小问题,我无法理解为什么要返回 unexpected T_IF
码:
$get_gender = array($getGender->getMaleGender());
$gender =
if ($gender->getGender()) {
echo "Male";
} else {
echo "Female";
}
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.
解:
$get_gender = array($getGender->getMaleGender());
if ($getGender->getIsMaleGender()) {
$result = "Male";
} else {
$result = "Female";
}
Run Code Online (Sandbox Code Playgroud)