Переглянути джерело

Pages commandes

feature/export_comptable
Fab 4 роки тому
джерело
коміт
e304db1e7b
3 змінених файлів з 60 додано та 2 видалено
  1. +57
    -0
      ShopBundle/Form/Backend/ReductionCart/AppliedToType.php
  2. +2
    -2
      ShopBundle/Resources/translations/lcshop.fr.yaml
  3. +1
    -0
      ShopBundle/Services/Price/OrderShopPriceUtils.php

+ 57
- 0
ShopBundle/Form/Backend/ReductionCart/AppliedToType.php Переглянути файл

@@ -0,0 +1,57 @@
<?php

namespace Lc\ShopBundle\Form\Backend\ReductionCart;

use Doctrine\ORM\EntityManagerInterface;

use Lc\ShopBundle\Context\PointSaleInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Model\ReductionCart;
use Lc\ShopBundle\Repository\GroupUserRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;

class AppliedToType extends AbstractType
{
protected $em;

public function __construct(EntityManagerInterface $entityManager)
{
$this->em = $entityManager;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$class = $this->em->getClassMetadata(PointSaleInterface::class);

$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($class) {
$builder = $event->getForm()->getParent();

$builder->add('appliedTo', ChoiceType::class, array(
'label' => 'field.Reduction.pointSalesActive',
'choices' => array(
'field.ReductionCart.appliedToOptions.' . ReductionCart::APPLIED_TO_ORDER_PRODUCTS => ReductionCart::APPLIED_TO_ORDER_PRODUCTS,
//'field.ReductionCart.appliedToOptions.' . ReductionCart::APPLIED_TO_DELIVERY => ReductionCart::APPLIED_TO_DELIVERY
),
'translation_domain' => 'lcshop',
'multiple' => false,
'expanded' => false
));

});
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
// 'translation_domain' => 'lcshop',
]);
}
}

+ 2
- 2
ShopBundle/Resources/translations/lcshop.fr.yaml Переглянути файл

@@ -242,8 +242,8 @@ field:
appliedTo: Appliquer aux
freeShipping: Frais de livraisons offert
appliedToOptions:
order: Montant de la commandes
shipping: Frais de livraisons
order-products: Montant de la commande
delivery: Frais de livraisons
unit: Unité
Address:
city: Commune

+ 1
- 0
ShopBundle/Services/Price/OrderShopPriceUtils.php Переглянути файл

@@ -117,6 +117,7 @@ class OrderShopPriceUtils implements OrderShopPriceUtilsInterface
{
$amount =0;
if($orderReductionCart->getAppliedTo() === ReductionCart::APPLIED_TO_ORDER_PRODUCTS) {

if ($orderReductionCart->getUnit() == 'percent') {
$amount = $this->amountReductionByPercentValue(
$this->getTotalOrderProducts($order),

Завантаження…
Відмінити
Зберегти