MAGENTO中的日期问题

2015-11-16  本文已影响114人  帅马

今天做了一个关于添加产品时间属性,让日期小于当前日期时,pdp页面显示当前产品xx时候开始销售,请等待…
1.建立magento日期属性
2.获取当前产品的日期属性
3.获取当前时间
4.转化时间进行比较

                <?php
                    $startDate = $_product->getResource()->getAttribute('sale_from_date')->getFrontend()->getValue($_product);
                    $endDate = date('Y-m-d');
                    $starDate = strtotime(strval($startDate));
                    $endDate = strtotime($endDate);
                ?>
                <?php
                    $startDate = $_product->getResource()->getAttribute('sale_from_date')->getFrontend()->getValue($_product);
                    $endDate = date('Y-m-d');
                    $starDate = strtotime(strval($startDate));
                    $endDate = strtotime($endDate);
                ?>
上一篇 下一篇

猜你喜欢

热点阅读