Лучший Ответ CB9TOIIIA , 17 April 2016 - 19:51
<?php foreach ($view->itemsHtml as $itemKey => $itemHtml) : ?> <?php $items = $order->getItems(false); $items2 = $items->$itemKey->params[buttons][addAlertText]; $cleanlable = str_replace('добавлен в корзину!', '', $items2); $cleanlable2 = str_replace('добавлена в корзину!', '', $cleanlable); //jbdump($cleanlable2,0,'Ищем лэйблы'); ?> <tr class="jbcart-row jsCartTableRow js<?php echo $itemKey; ?>" data-key="<?php echo $itemKey; ?>"> <td class="jbcart-image"> <?php if ($config->get('tmpl_image_show', 1)) { echo $itemHtml['image']; } ?> </td> <td class="jbcart-name"> <?php $newname = str_replace('</a>', ' ( '.$cleanlable2.')</a>', $itemHtml['name']); echo $newname; ?> <?php if ($config->get('tmpl_sku_show', 1)) { echo $itemHtml['sku']; } ?> <?php echo $itemHtml['params']; ?> </td> <td class="jbcart-price"><?php if ($config->get('tmpl_price4one', 1)) { echo $itemHtml['price4one']; } ?> </td> <td class="jbcart-quantity"><?php if ($config->get('tmpl_quntity', 1)) { echo $itemHtml['quantityEdit']; } ?> </td> <td class="jbcart-subtotal"> <?php if ($config->get('tmpl_subtotal', 1)) { echo $itemHtml['totalsum']; } ?> </td> <td class="jbcart-delete"> <a class="btn btn-danger btn-xs btn-small round jsDelete"> <?php echo JText::_('JBZOO_CART_DELETE'); ?> </a> </td> </tr> <?php endforeach; ?>
или так:
<?php foreach ($view->itemsHtml as $itemKey => $itemHtml) : ?> <?php $items = $order->getItems(false); $items2 = $items->$itemKey->params[buttons][addAlertText]; $cleanlable = str_replace('добавлен в корзину!', '', $items2); $cleanlable2 = str_replace('добавлена в корзину!', '', $cleanlable); $cleanlable2 = rtrim($cleanlable2); //jbdump($cleanlable2,0,'Ищем лэйблы'); ?> <tr class="jbcart-row jsCartTableRow js<?php echo $itemKey; ?>" data-key="<?php echo $itemKey; ?>"> <td class="jbcart-image"> <?php if ($config->get('tmpl_image_show', 1)) { echo $itemHtml['image']; } ?> </td> <td class="jbcart-name"> <?php $newname = str_replace('</a>', ' ('.$cleanlable2.')</a>', $itemHtml['name']); echo $newname; ?> <?php if ($config->get('tmpl_sku_show', 1)) { echo $itemHtml['sku']; } ?> <?php echo $itemHtml['params']; ?> </td> <td class="jbcart-price"><?php if ($config->get('tmpl_price4one', 1)) { echo $itemHtml['price4one']; } ?> </td> <td class="jbcart-quantity"><?php if ($config->get('tmpl_quntity', 1)) { echo $itemHtml['quantityEdit']; } ?> </td> <td class="jbcart-subtotal"> <?php if ($config->get('tmpl_subtotal', 1)) { echo $itemHtml['totalsum']; } ?> </td> <td class="jbcart-delete"> <a class="btn btn-danger btn-xs btn-small round jsDelete"> <?php echo JText::_('JBZOO_CART_DELETE'); ?> </a> </td> </tr> <?php endforeach; ?>
и наверное красивый последний вариант:
<?php foreach ($view->itemsHtml as $itemKey => $itemHtml) : ?> <?php $items = $order->getItems(false); $items2 = $items->$itemKey->params[buttons][addAlertText]; $cleanlable = str_replace('добавлен в корзину!', '', $items2); $cleanlable2 = str_replace('добавлена в корзину!', '', $cleanlable); $cleanlable2 = rtrim($cleanlable2); //jbdump($cleanlable2,0,'Ищем лэйблы'); ?> <tr class="jbcart-row jsCartTableRow js<?php echo $itemKey; ?>" data-key="<?php echo $itemKey; ?>"> <td class="jbcart-image"> <?php if ($config->get('tmpl_image_show', 1)) { echo $itemHtml['image']; } ?> </td> <td class="jbcart-name"> <?php $newname = str_replace('</a>', ' ('.$cleanlable2.')</a>', $itemHtml['name']); if (preg_match('/Товар/', $cleanlable2)) { echo $itemHtml['name']; } else { echo $newname; } ?> <?php if ($config->get('tmpl_sku_show', 1)) { echo $itemHtml['sku']; } ?> <?php echo $itemHtml['params']; ?> </td> <td class="jbcart-price"><?php if ($config->get('tmpl_price4one', 1)) { echo $itemHtml['price4one']; } ?> </td> <td class="jbcart-quantity"><?php if ($config->get('tmpl_quntity', 1)) { echo $itemHtml['quantityEdit']; } ?> </td> <td class="jbcart-subtotal"> <?php if ($config->get('tmpl_subtotal', 1)) { echo $itemHtml['totalsum']; } ?> </td> <td class="jbcart-delete"> <a class="btn btn-danger btn-xs btn-small round jsDelete"> <?php echo JText::_('JBZOO_CART_DELETE'); ?> </a> </td> </tr> <?php endforeach; ?>