如何解决如何将PrestaShop 1.7 Checkout手风琴步骤转换为步骤进度栏?
我对PrestaShop和PHP还是很陌生,我被要求将PrestaShop 1.7(经典主题)的当前手风琴结帐步骤转换为步骤进度栏。我有一些足够好的CSS概念和一些JavaScript,但是当我查看PrestaShop文件时,我完全迷失了。 :(
这里有一些代码(注释中是我尝试添加以创建步骤进度栏的内容)。 checkout-process.tpl是个谜:
{foreach from=$steps item="step" key="index"}
{render identifier = $step.identifier
position = ($index + 1)
ui = $step.ui
{* steps = $steps *}
}
{/foreach}
然后我有checkout-step.tpl:
{block name='step'}
{* <div id="checkout-steps">
<ul id="checkout-steps__bar">
{foreach from=$steps item="step" key="index"}
<li id="{$step.identifier}" class="step-title h3">{$step.title}</li>
{/foreach}
</ul>
</div> *}
<section id="{$identifier}" class="{[
'checkout-step' => true,'-current' => $step_is_current,'-reachable' => $step_is_reachable,'-complete' => $step_is_complete,'js-current-step' => $step_is_current
]|classnames}">
<h1 class="step-title h3">
<i class="material-icons rtl-no-flip done"></i>
<span class="step-number">{$position}</span>
{$title}
<span class="step-edit text-muted">
<img src="{$urls.img_url}/icn/edit.png" alt="{l s='Update' d='Shop.Theme.Actions'}" class="icn-16" />
{l s='Edit' d='Shop.Theme.Actions'}</span>
</h1>
<div class="content">
{block name='step_content'}DUMMY STEP CONTENT{/block}
</div>
</section>
{/block}
我设法通过编辑CheckoutProcess.PHP来获得标题:
public function render(array $extraParams = array())
{
$scope = $this->smarty->createData(
$this->smarty
);
$params = array(
'steps' => array_map(function (CheckoutStepInterface $step) {
return array(
'identifier' => $step->getIdentifier(),'ui' => new RenderableProxy($step),// Add title to steps array
'title' => $step->getTitle(),);
},$this->getSteps()),);
$scope->assign(array_merge($extraParams,$params));
$tpl = $this->smarty->createTemplate(
$this->template,$scope
);
return $tpl->fetch();
}
我认为我做的不是正确的事情,但是如果我几乎了解那里发生的事情,那么我不知道从哪里开始。 -_-“ 如果有人得到了一些建议甚至更好的建议(一个人总是可以梦想)已经尝试了这种修改,我将很高兴收到任何信息,帮助和代码示例! 预先感谢。
解决方法
花了我一段时间,这可能不是最好的方法,但是我通过添加进度条然后使用自定义CSS和JavaScript覆盖默认行为来管理转换。
有很多代码,我不确定是否在其中发布有用,但是如果有人想要一些信息或代码,我会很乐意分享!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。