All Activity
- Past hour
-
vistasadmedia joined the community
-
[SOLVED] PHP show all products with quantity combination equal to 0 ?
catzarov replied to catzarov's topic in Core developers
Hello, I found the solution myself, I will not use API but directly with database connection. The lower code for version 1.7.8.7 works correctly, which makes me very happy. I tested it on several products that were purchased in their last available sizes and had 0 quantity in the menu Monitoring -> "List of products with combinations but without available quantities for sale". With the code below, it is much faster to remove the 0 quantity. <?php $servername = "localhost"; // $username = ""; // $password = ""; // $dbname = ""; // $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT id_product FROM ps17_product WHERE active = 1"; $result = $conn->query($sql); $active_products = array(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $active_products[] = $row["id_product"]; } } $zero_quantity_attributes = array(); foreach ($active_products as $product_id) { $sql = "SELECT pa.id_product_attribute FROM ps17_product_attribute pa JOIN ps17_stock_available sa ON pa.id_product_attribute = sa.id_product_attribute WHERE pa.id_product = $product_id AND sa.quantity = 0 AND pa.id_product_attribute NOT IN ( SELECT pa2.id_product_attribute FROM ps17_product_attribute pa2 JOIN ps17_stock_available sa2 ON pa2.id_product_attribute = sa2.id_product_attribute WHERE pa2.id_product = $product_id AND sa2.quantity > 0 )"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $zero_quantity_attributes[$product_id][] = $row["id_product_attribute"]; } } } $attribute_ids = array(); foreach ($zero_quantity_attributes as $product_id => $attributes) { foreach ($attributes as $attribute_id) { $sql = "SELECT id_attribute FROM ps17_product_attribute_combination WHERE id_product_attribute = $attribute_id"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $attribute_ids[$product_id][$attribute_id][] = $row["id_attribute"]; } } } } $attribute_names = array(); foreach ($attribute_ids as $product_id => $attributes) { foreach ($attributes as $attribute_id => $attribute_list) { foreach ($attribute_list as $attribute) { $sql = "SELECT name FROM ps17_attribute_lang WHERE id_attribute = $attribute AND id_lang = 1"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $attribute_names[$product_id][$attribute_id][] = $row["name"]; } } } } } if (count($attribute_names) > 0) { foreach ($attribute_names as $product_id => $attributes) { echo "<p>Product ID: $product_id</p>"; echo "<ul>"; foreach ($attributes as $attribute_id => $attribute_list) { foreach ($attribute_list as $attribute_name) { echo "<li>$attribute_name <form method='POST'><input type='hidden' name='product_id' value='$product_id'><input type='hidden' name='attribute_id' value='$attribute_id'><input type='submit' name='delete_attribute' value='DELETE'></form></li>"; } } echo "</ul>"; } } else { echo "No products with zero quantity found."; } if (isset($_POST['delete_attribute'])) { $product_id = $_POST['product_id']; $attribute_id = $_POST['attribute_id']; $sql_delete = "DELETE FROM ps17_product_attribute WHERE id_product = $product_id AND id_product_attribute = $attribute_id"; if ($conn->query($sql_delete) === TRUE) { echo "The attribute has been successfully deleted."; } else { echo "An error occurred when deleting the attribute: " . $conn->error; } } $conn->close(); ?> Best regards to all -
Parisaline12 joined the community
-
panalokoph started following [Solved]'ish Integrating Prestashop into a pre-developed website
-
Expected argument of type "object, array or empty", "string" given
jamshidpour replied to nouha88's topic in General topics
Thank you @Andrei H As you told, it worked great after changing the config file. -
Jak wykluczyć przewoźnika z darmowej dostawy
oszman replied to oszman's question in Wsparcie i pomoc użytkowników
@Mabcin Ok tylko jest kwestia tego, że ja muszę mieć zamówienie według wagi zdefiniowane nie według ceny całkowitej. Klient mi zamówi za 15 zł na wagę 1k i co wtedy ? dlatego chyba nie mogę ustawić takiej reguły jaką mi podałeś?? bo jak widać do każdej wagi mam przypisaną cenę w sensie z zakresu. -
Veeels changed their profile photo
-
Magicweb started following Devis pour dupliquer une boutique
-
Postaw nowy na sub domenie, później tylko przepnij domenę na hostingu na nowy folder i zmień w bazie danych url. Jeśli nie robisz migracji produktów etc, to wystarczy.
-
angelvicedo started following Modulo Google Rich Snippets Prestashop 1.7
-
Modulo Google Rich Snippets Prestashop 1.7
angelvicedo replied to FERREIDEA's topic in Discusión general
Hola, que modulo compraste al final? @Roberto P- 11 replies
-
- rich snippets prestashop
- rich snippet
-
(and 4 more)
Tagged with:
-
Jak wykluczyć przewoźnika z darmowej dostawy
Mabcin replied to oszman's question in Wsparcie i pomoc użytkowników
Takie ustawienie jak to które podaje niżej daje Ci, że masz płatną dostawę 15zł dla każdego zamówienia do 2tys zł. Powyżej tej kwoty jest darmowa dostawa. I musisz wtedy dal każdego przewoźnika zrobić taką regułę. A dla Pobrania które nie chce by było darmowe ustawiasz jak na drugim zdjęciu (od 0 do jakiejś dużej kwoty) -
whatawomancom changed their profile photo
-
Nie bardzo rozumiem co masz na myśli. Może źle opisałem sprawę. Ja nie chce postawić sklepu opartego o prestashop 8 na podstawie starej bazy ze sklepu 1.6. Tylko chce postawić nowy czysty sklep na 8 i potem tylko podmienić je w "całości"
- Today
-
500 Internal Server Error
JBW replied to Osama89's topic in Utilisation de PrestaShop : configuration et difficultés
Yes you can manually restore the database -
500 Internal Server Error
Osama89 replied to Osama89's topic in Utilisation de PrestaShop : configuration et difficultés
Can I do a rollback, for the database before the update? Will it solve the problem? -
JBW started following 500 Internal Server Error
-
500 Internal Server Error
JBW replied to Osama89's topic in Utilisation de PrestaShop : configuration et difficultés
This is one of the core tables that is missing, check you database! -
500 Internal Server Error
Osama89 replied to Osama89's topic in Utilisation de PrestaShop : configuration et difficultés
-
skinnybloke started following How do I override an image in a 3rd party module under v8.1.5
-
how to call php function in .tpl page
dysmant replied to dysmant's topic in Configuring and using PrestaShop
Thank You.. I will try this.. -
500 Internal Server Error
ComGrafPL replied to Osama89's topic in Utilisation de PrestaShop : configuration et difficultés
-
500 Internal Server Error
Osama89 replied to Osama89's topic in Utilisation de PrestaShop : configuration et difficultés
-
500 Internal Server Error
ComGrafPL replied to Osama89's topic in Utilisation de PrestaShop : configuration et difficultés
Enable debug mode / depend on version clear cache in VAR folder. -
Hello, I am having this message "500 Internal Server Error" when I am trying to open my website, back-office and the main site. This happened when I did a restore to my website after updating it to the last version with the module 1 click update. Any ideas on how I can fix the problem, and try to connect to my website ? Thanks.
-
Hello, Did you find the solution via Webservice for this?
- 5 replies
-
- prestashop api
- webservice
-
(and 1 more)
Tagged with:
-
swissamf changed their profile photo
-
Hi, Modify the product page template (product.tpl) in your theme to conditionally hide the shipping section or display "Shipping: N/A" for products that are only available for click and collect. You can use PHP logic to check if the product belongs to a category or has a specific attribute indicating it's only available for click and collect. If so, display "Shipping: N/A" or hide the shipping section altogether. OR Look for a module in the Prestashop marketplace that allows you to manage shipping options more granularly. Ref : https://addons.prestashop.com/en/search?search_query=shipping Hope this would help. Thanks!
-
Bonjour tout le monde, voilà j'ai fini de développé depuis quelques jour un module qui utilise l'API Google Maps pour autocompléter les adresse, il est 100% fonctionnel en local et sur un site de test également, sous le thème de base "classic" Je l'ai donc installer directement via le BO avec le dossier de mon module en .zip et je l'ai configuré. Et à ma grande surprise, il ne fonctionne pas. Et je remarque que sur l'enregistrement de mes script, seul l'appel à l'API fonctionne, pas pas l'appel à mon fichier JS de mon module, je vous partage l'extrait ci-dessous : public function hookActionFrontControllerSetMedia() { // Vérifier si nous sommes sur la page de commande ou de l'adresse $currentUrl = $_SERVER['REQUEST_URI']; if (strpos($currentUrl, '/commande') !== false || strpos($currentUrl, '/adresse') !== false) { $this->context->controller->registerJavascript( 'module-googleadressautocomplete', 'modules/' . $this->name . '/views/js/googleadressautocomplete.js', array('position' => 'bottom', 'priority' => 10) ); $countries = Configuration::get('GOOGLEADRESSAUTOCOMPLETE_COUNTRIES'); Media::addJsDef(array('autocompleteCountries' => explode(',', $countries))); $apiKey = Configuration::get('GOOGLEADRESSAUTOCOMPLETE_APIKEY'); $this->context->controller->registerJavascript( 'google_maps_api', 'https://maps.googleapis.com/maps/api/js?key=' . $apiKey . '&callback=initAutocomplete&libraries=places', array('server' => 'remote', 'position' => 'bottom', 'priority' => 20) ); } } la seconde partie est bien prises en compte et fonctionne, le script du lien de l'API est bien charger sur ma page, mais le premier bout de code qui veut injecter mon fichier javascript de mon module n'est pas récupérer sur le site. Comment est-ce possible ? Je m'arrache les cheveux depuis hier après-midi. Si quelqu'un à déjà eu le cas, ce serais cool, merci à vous et bonne journée !
-
My Contact Us did not working
AddWeb Solution replied to Truong Chan Duong's topic in General topics
Hi, Check that your email settings in Prestashop are correctly configured. Double-check the SMTP server settings (host, port, username, password, encryption) provided by your email service provider. Sometimes, incorrect SMTP settings can prevent emails from being sent. Enable debug mode in PrestaShop to get more detailed error messages. Hope this would help. Thanks!