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
.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) {
/**
* Tailwind's Preflight Style Reset
* https://tailwindcss.com/docs/preflight
*
* Why is this here?
* 1. Tailwind doesn't publish their style reset (which is
* derived from modern-normalize).
* 2. TailwindCSS's version of this doesn't work with third-party
* DOM elements that it can't extract.
*/
@unlocomqx
unlocomqx / cypress_test_404_spec.js
Created April 27, 2024 04:03 — forked from paulmwatson/cypress_test_404_spec.js
Testing a 404 page with Cypress
cy.visit('/404')
//=> Test fails
cy.visit('/404', {failOnStatusCode: false})
//=> Test passes but does not test the HTTP code was 404
cy.request({url: '/404', failOnStatusCode: false}).its('status').should('equal', 404)
cy.visit('/404', {failOnStatusCode: false})
//=> Test passes, tests that the HTTP code was 404, and tests page was visited
.dp_group_options_qty .content {
display: grid;
grid-auto-flow: column;
grid-template-rows: 1fr 1fr;
grid-auto-columns: auto;
justify-items: center;
justify-content: start;
column-gap: .5rem;
row-gap: 0;
}
@unlocomqx
unlocomqx / products.php
Created January 30, 2024 19:37
Read option sku
<?php
/** @var $id_product */
/* @var DynamicInputField[] $input_fields */
/* @var $dropdown */
/* @var $dropdown_ref */
use DynamicProduct\classes\models\dynamic_fields\DropDownField;
use DynamicProduct\classes\models\DynamicField;
<?php
// The ID of the current product
/** @var int $id_product */
// The selected combination ID
/** @var int $id_attribute */
// The current selected quantity
/** @var int $quantity */