Browse Source

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

develop
Fab 3 years ago
parent
commit
f7524b4876
6 changed files with 171 additions and 7 deletions
  1. +88
    -0
      ShopBundle/Model/OpenGraphTrait.php
  2. +1
    -2
      ShopBundle/Resources/public/js/backend/script/default/init-common.js
  3. +7
    -2
      ShopBundle/Resources/translations/lcshop.fr.yaml
  4. +1
    -0
      ShopBundle/Services/MailjetSmsUtils.php
  5. +5
    -3
      ShopBundle/Services/Price/ProductPriceUtils.php
  6. +69
    -0
      ShopBundle/Services/Utils.php

+ 88
- 0
ShopBundle/Model/OpenGraphTrait.php View File

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

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;


trait OpenGraphTrait
{
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $openGraphTitle;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $openGraphDescription;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $openGraphImage;

/**
* @Vich\UploadableField(mapping="images", fileNameProperty="openGraphImage")
* @var File
*/
protected $openGraphImageFile;


public function getOpenGraphTitle(): ?string
{
return $this->openGraphTitle;
}

public function setOpenGraphTitle(string $openGraphTitle): self
{
$this->openGraphTitle = $openGraphTitle;

return $this;
}

public function getOpenGraphDescription(): ?string
{
return $this->openGraphDescription;
}

public function setOpenGraphDescription(?string $openGraphDescription): self
{
$this->openGraphDescription = $openGraphDescription;

return $this;
}

public function getOpenGraphImage(): ?string
{
return $this->openGraphImage;
}

public function setOpenGraphImage(?string $openGraphImage): self
{
$this->openGraphImage = $openGraphImage;

return $this;
}

public function setOpenGraphImageFile(File $openGraphImageFile = null)
{
$this->openGraphImageFile = $openGraphImageFile;

// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
if ($openGraphImageFile) {
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedAt = new \DateTime('now');
}
}

public function getOpenGraphImageFile()
{
return $this->openGraphImageFile ;
}

}

+ 1
- 2
ShopBundle/Resources/public/js/backend/script/default/init-common.js View File

@@ -362,8 +362,7 @@ function resetNumItemsCollectionField($collectionWidget){


function initBtnShowTotalOrderProduct(){
log( $('.lc-show-products-sales-statistic'));
$('.lc-show-products-sales-statistic').on('click', function (){
$('.lc-show-products-sales-statistic').unbind('click').on('click', function (){
$btn = $(this);
var url = $(this).data('url');
$('#modal-products-sales-statistic').remove();

+ 7
- 2
ShopBundle/Resources/translations/lcshop.fr.yaml View File

@@ -80,6 +80,8 @@ group:
waitingBankReturn: Commandes en attente de retour banque
list: Liste des commandes
giftVoucher: Commandes de bons cadeaux
multiplePayment: Paiements multiples

Ticket:
listMessages: Liste des messages
list: Tickets ouverts
@@ -298,8 +300,8 @@ field:
emailFromPurchaseOrder: "Email (From) : bons de commande"
order: Commande
subject: Sujet
metaTitle: Meta title
metaDescription: Meta description
metaTitle: Titre (meta)
metaDescription: Description (meta)
users: Utilisateurs
total: Total
products: Produits
@@ -313,6 +315,9 @@ field:
ticketTypesNotification: Catégorie ticket
newsletter: Newsletter
isEligibleTicketRestaurant: Éligible ticket restaurant
openGraphTitle: Titre (OpenGraph)
openGraphDescription: Description (OpenGraph)
openGraphImageFile: Image (OpenGraph)

PointSale:
code: Code

+ 1
- 0
ShopBundle/Services/MailjetSmsUtils.php View File

@@ -94,6 +94,7 @@ class MailjetSmsUtils
return $content;
} else {
// log
return $response->getContent() ;
}
}
else {

+ 5
- 3
ShopBundle/Services/Price/ProductPriceUtils.php View File

@@ -67,12 +67,14 @@ class ProductPriceUtils
public function getPriceByRefUnitWithTaxAndReduction(ProductPropertyInterface $product)
{

return $this->applyReductionCatalog(
return ($this->getPriceByRefUnitWithTax($product) * $this->getPriceWithTaxAndReduction($product))
/ $this->getPriceWithTax($product) ;

/*return $this->applyReductionCatalog(
$product,
$this->getPriceByRefUnit($product),
$this->getPriceByRefUnitWithTax($product)
);

);*/
}



+ 69
- 0
ShopBundle/Services/Utils.php View File

@@ -615,5 +615,74 @@ class Utils
return $phone ;
}

public function getMetaTitle($entity)
{
if($entity) {
if(method_exists($entity, 'getMetaTitle')) {
return $entity->getMetaTitle() ;
}
elseif(method_exists($entity, 'getTitle')) {
return $entity->getTitle() ;
}
}

return '' ;
}

public function getMetaDescription($entity)
{
if($entity) {
if(method_exists($entity, 'getMetaDescription')) {
return $entity->getMetaDescription() ;
}
elseif(method_exists($entity, 'getDescription')) {
return $entity->getDescription() ;
}
}

return '' ;
}

public function getOpenGraphTitle($entity)
{
if($entity) {
if(method_exists($entity, 'getOpenGraphTitle')) {
return $entity->getOpenGraphTitle() ;
}
elseif(method_exists($entity, 'getTitle')) {
return $entity->getTitle() ;
}
}

return '' ;
}

public function getOpenGraphDescription($entity)
{
if($entity) {
if(method_exists($entity, 'getOpenGraphDescription')) {
return $entity->getOpenGraphDescription() ;
}
elseif(method_exists($entity, 'getDescription')) {
return $entity->getDescription() ;
}
}

return '' ;
}

public function getOpenGraphImage($entity)
{
if($entity) {
if(method_exists($entity, 'getOpenGraphImage')) {
return $entity->getOpenGraphImage() ;
}
elseif(method_exists($entity, 'getImage')) {
return $entity->getImage() ;
}
}

return '' ;
}

}

Loading…
Cancel
Save