magento检查产品值是否包含特定单词

时间:2014-10-21 09:24:41

标签: php magento

使用magento我有一个产品的自定义选项,其中的行包含日期,然后是位置作为标题。例如,选项可以是:*

  • 10月29日 - 伦敦,
  • 11月26日 - 利兹,
  • 11月28日 - 伦敦。

是否可以根据自定义选项的标题值的一部分编写if else语句?

例如

<?php if($value == "Leeds"): ?>
Content
<?php else : ?>
other content 
<?php endif : ?>

另外,如何调用自定义选项值?

1 个答案:

答案 0 :(得分:0)

查看strpospreg_match

$mystring = '6th November - Leeds';
$findme   = 'Leeds';
$pos = strpos($mystring, $findme);

if ($pos !== false) {
     // Content
} else {
     // other content
}
相关问题