Apuntes SpecialPrice Prestashop

Hola estimado lector, hoy estoy aquí para dejar ciertos apuntes acerca de cómo crear un specialprice en PrestaShop, por aquí dejo los apuntes, de cómo lo he hecho, espero que os guste y que os sea de ayuda o de gran utilidad.

/**
 * @param int $id_product
 * @param int $id_product_attribute si 0 para todos los atributos
 * @param float $reduction_value ie. 0.07 significa 7% cuando porcentaje, como $reduction_type y 10.00 significa 10 cuando es «amount»
 * @param string $reduction_type puede ser ‘percentage’ o ‘amount’
 * @param int $tax if set to 1 then price of specific price is brutto if 0 then netto
 * @param string $from_date is ‘YYYY-MM-DD HH:MM:SS’
 * @param string $to_date is ‘YYYY-MM-DD HH:MM:SS’
 * @param int $from_quantity desde qué cantidad
 * @param int $id_shop 0 para todos
 * @param int $id_shop_group 0 para todos
 * @param int $id_currency 0 para todos
 * @param int $id_country 0 para todos
 * @param int $id_customer 0 para todos
 * @param int $price es siempre -1
 * @param int $from_quantity por defecto es 1
 * @return int id ID del producto creado
 */

    $specificPrice = new SpecificPrice();
    $specificPrice->id_product = (int)$id_product;
    $specificPrice->id_product_attribute = (int)$id_product_attribute; // if 0 then for all attributes

    $specificPrice->reduction = $reduction_value; // 7% is 0.07
    $specificPrice->reduction_type = $reduction_type;
    $specificPrice->reduction_tax = $tax;
    $specificPrice->id_shop = $id_shop;
    $specificPrice->id_currency = $id_currency;
    $specificPrice->id_country = $id_country;
    $specificPrice->id_group = $id_shop_group;
    $specificPrice->id_customer = $id_customer;
    $specificPrice->price = $price;
    $specificPrice->from_quantity = $from_quantity;
    $specificPrice->from = $from_date;
    $specificPrice->to = $to_date;

    $specificPrice->add();
    $specificPrice->save();
    $addedPriceId = $specificPrice->id;

    return $addedPriceId;

Pues nada hasta aquí mi post de hoy, espero que os haya sido de utilidad, que hayáis aprendido algo, sin más me despido, un saludo y hasta la próxima.

FUENTE

https://www.prestashop.com/forums/topic/649790-specific-price-through-code-programatic-way/ usuario hakeryk2

Deja un comentario

Información básica sobre protección de datos Ver más

  • Responsable: Tomas Gonzalez.
  • Finalidad:  Moderar los comentarios.
  • Legitimación:  Por consentimiento del interesado.
  • Destinatarios y encargados de tratamiento:  No se ceden o comunican datos a terceros para prestar este servicio.
  • Derechos: Acceder, rectificar y suprimir los datos.
  • Información Adicional: Puede consultar la información detallada en la Política de Privacidad.

error: Content is protected !!

Descubre más desde InfoGonzalez - Blog de formador e informático

Suscríbete ahora para seguir leyendo y obtener acceso al archivo completo.

Seguir leyendo

Este sitio web utiliza cookies, si necesitas más información puedes visitar nuestra política de privacidad    Ver
Privacidad
Creative Commons License
Except where otherwise noted, the content on this site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.