TheMaster Posted January 29, 2021 Report Share Posted January 29, 2021 Am am fan of standard order template but i wanted it to be boxes instate of list , so i play around with it and i came out with the attached Image i share it here there might be some one who is interested and like it if any one interested to use it here is the code (replace the file /plugins/order/views/templates/standard/main_index.pdt) with bellow code; Quote make sure you make a a backup copy of your file before doing this <?php foreach ($package_groups as $group_id => $package_group) { if (!array_key_exists($group_id, $packages)) { continue; } $this->WidgetClient->clear(); $this->WidgetClient->create($this->Html->ifSet($package_group->name)); ?> <div class="card-body"> <div class="row"> <?php $j = 0; asort($packages[$group_id]); foreach ($packages[$group_id] as $package) { // Only render package if there are pricing options available if (empty($package->pricing)) { continue; } ?> <?php if ($j++ > 0) { ?> <hr /> <?php } ?> <div class="col-md-6 col-lg-4 col-xl-3 p-3"> <div class="border"> <div class="text-center text-white p-1 bg-danger"><strong><?php $this->Html->_($package->name);?></strong></div> <div class="pkg-description p-1"> <?php echo ($this->Html->ifSet($package->description_html) != '' ? $package->description_html : $this->TextParser->encode($parser_syntax, $package->description));?> </div> <div class="text-center p-1"> <?php $this->Form->create(null, ['class' => 'sdisable-on-submit', 'role' => 'form']); $sold_out = $this->Html->ifSet($package->qty, null) == '0'; $limit_reached = $package->client_qty !== null && $package->client_qty <= $this->Html->ifSet($package_counts[$package->id], 0); // Prevent sold out packages from being submitted if (!$sold_out && !$limit_reached) { $this->Form->fieldHidden('group_id', $group_id); } ?> <div class="form-group"> <?php $prices = []; foreach ($package->pricing as $price) { if ($this->Html->ifSet($price->period) == 'onetime') { $period = $this->Html->ifSet($periods[$price->period]); } else { $term = $this->Html->_($price->term, true); $period = $this->Html->concat(' ', $term, ($term == 1 ? $this->Html->ifSet($periods[$price->period]) : $this->Html->ifSet($periods[$price->period . '_plural']))); } // Set the pricing text to include or not include renewal pricing $prices[$price->id] = ($this->Html->ifSet($price->period) == 'onetime' || ($this->Html->ifSet($price->price) == $this->Html->ifSet($price->price_renews)) ? $this->_('Main.index.package_price', true, $period, $this->CurrencyFormat->format($this->Html->ifSet($price->price), $this->Html->ifSet($price->currency))) : $this->_('Main.index.package_price_recurring', true, $period, $this->CurrencyFormat->format($this->Html->ifSet($price->price), $this->Html->ifSet($price->currency)), $this->CurrencyFormat->format($this->Html->ifSet($price->price_renews), $this->Html->ifSet($price->currency))) ); } $this->Form->fieldSelect('pricing_id', $prices, null, ['class' => 'form-control input-sm']); ?> </div> <?php if ($sold_out) { ?> <div class="btn btn-sm btn-danger form-group" disabled="disabled"><i class="fas fa-ban"></i> <?php $this->_('Main.index.sold_out');?></div> <?php } elseif ($limit_reached) { ?> <div class="btn btn-sm btn-danger form-group" disabled="disabled"><i class="fas fa-ban"></i> <?php $this->_('Main.index.client_limit');?></div> <?php } else { ?> <button type="submit" class="btn btn-dark btn-sm form-group"><i class="fas fa-shopping-cart"></i> <?php $this->_('Main.index.select_btn');?></button> <?php } $this->Form->end(); ?> </div> <div class="clearfix"></div> </div> </div> <?php } ?> </div> </div> <?php $this->WidgetClient->end(); } ?> Franz and Paul 2 Quote Link to comment Share on other sites More sharing options...
Paul Posted January 29, 2021 Report Share Posted January 29, 2021 Looks good, thanks for sharing! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.