Skip to content

Instantly share code, notes, and snippets.

View unlocomqx's full-sized avatar
🏠
Working from home

Tuni-Soft unlocomqx

🏠
Working from home
  • Module Dev - Tuni-Soft
  • [object Object]
View GitHub Profile
<?php
// Attach module to hook
$this->registerHook('actionCartDuplicate');
// Run custom logic when the hook is triggered
public function hookActionCartDuplicate($params)
{
$id_cart_old = $params['oldCartId'];
$id_cart_new = $params['newCartId'];
# update id_module because it has changed after the new installation
UPDATE `pr_customized_data`
SET `id_module` = (SELECT `id_module` FROM `pr_module` WHERE `name` = 'dynamicproduct')
WHERE `id_module` = 96
# many rows are missing from the dynamicproduct_input table. To find the orders that have data
SELECT o.id_order, i.id_input, c.id_cart FROM `pr_cart` c
JOIN `pr_orders` o ON o.id_cart = c.id_cart
CREATE TABLE IF NOT EXISTS `ps_tunisoft_customization_field`
(
`id_customization_field` int(11) NOT NULL,
`id_module` int(11) NOT NULL,
PRIMARY KEY (`id_customization_field`, `id_module`)
) ENGINE = InnoDb
DEFAULT CHARSET = utf8;
window.dsn_stores.design.subscribe(function (design_data) {
Object.values(design_data.containers).forEach((container) => {
Object.values(container.items).forEach((item) => {
item.subscribe((item_data) => {
console.log(item_data)
})
})
})
})
<?php
/* Path
--> /src/Adapter/Presenter/Product/ProductLazyArray.php
*/
// Change
$this->product['has_discount'] = (0 != $product['reduction']);
<?php
// reverse group discount
if (isset($reverse_discount)) {
$reverse_discount = 1;
$group_reduction = (float)\Group::getReduction(Context::getContext()->customer->id);
if ($group_reduction > 0) {
$reverse_discount = 1 / (1 - $group_reduction / 100);
}
SELECT od.* FROM ps_order_detail od
LEFT JOIN ps_dynamicproduct_input di ON di.id_customization = od.id_customization
LEFT JOIN ps_dynamicproduct_input_field dif ON dif.id_input = di.id_input AND dif.type = 8 #dropdown type
LEFT JOIN ps_dynamicproduct_dropdown_option ddo ON ddo.id_field = dif.id_field AND ddo.sku = '10x10'
LEFT JOIN ps_orders o ON o.id_order = od.id_order
WHERE o.date_add BETWEEN '2024-04-24 14:04:49' AND '2024-04-25 14:04:49'
<?php
/** @var int $id_product */
/** @var float $product_price */
use DynamicProduct\classes\DynamicTools;
use DynamicProduct\classes\module\DynamicCalculator;
if (isset($reverse_discount)) {
<?php
/** @var int $id_product */
/** @var float $product_price */
use DynamicProduct\classes\DynamicTools;
use DynamicProduct\classes\module\DynamicCalculator;
if(isset($vat)) {
{
"logo_field": "upload_pms_finder",
"color_count_field": "nb_colors",
"color_table": "yarn_colortable.csv",
"default_image": "https://yeslogo.eu/themes/at_movic/assets/img/modules/leoslideshow/slider1920x900_embroidery_medium.jpg",
"max_colors": 5,
"nb_closest_yarns": 3
}