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
// 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
}
.dsn-customize {
padding: 20px 45px;
background: #00857d !important;
font-size: 14px;
}
.dsn-customize:before {
font: normal normal normal 14px/1 FontAwesome;
content: "\f1fc";
margin-right: 0.3em;
{
"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
}
let reset_next = false // flag used to reset the quantity to the minimal quantity after adding to cart
document.addEventListener("dp-loaded", function () {
const addToCart = ceFrontend.utils.urlActions.actions.addToCart
ceFrontend.utils.urlActions.actions.addToCart = function (e) {
window.dpSaveCustomization().then(function (response) {
if (response) {
var id_customization = getFirstItem(response.id_customizations)
jQuery("[name=\"id_customization\"]").val(id_customization)
reset_next = true
addToCart({}, e)
Possible issue with cloudflare workers caused by a canceled promise
Hi 👋
I'm not entirely sure of the exact cause of this issue but I created a minimal repro. maybe someone can pinpoint the source of the issue.
Here's the repo
https://github.com/unlocomqx/cloudflare-error-1101
Here's the deploy to see the issue directly
https://b8aef2ad.cloudflare-error-1101.pages.dev/db
// To be placed in /themes/[current theme]/assets/js/dynamic/custom.js (create the "dynamic" folder)
const dp_container = document.querySelector('#dp_product');
dp_container.style.width = "100%"
window.dp_hook_after = dp_container.closest('.elementor-widget').previousSibling
window.dp_price_hook = ".ce-product-price span"
$(document).on("dp-loaded", function () {
const addToCart = ceFrontend.utils.urlActions.actions.addToCart;
ceFrontend.utils.urlActions.actions.addToCart = function (e) {