Answer the question
In order to leave comments, you need to log in
How to set a condition for some goods in modx?
There is such a code for promo codes
<?php
if($view == 1){
$promo = '';
if($_SESSION['promo']){
$promo = $_SESSION['promo'];
}
if($_POST['promo']){
$promo = $_POST['promo'];
}
return $promo;
}
$_POST['discount'] = 0;
if($_SESSION['promo']){
$promo = $_SESSION['promo'];
}
if($_POST['promo']){
$_SESSION['promo'] = trim(mysql_real_escape_string($_POST['promo']));
$promo = $_SESSION['promo'];
}
if ($modx->getObject('modResource',array('pagetitle' => $promo,'published' =>1))){
$res = $modx->getObject('modResource',array('pagetitle' => $promo,'published' =>1));
$price = str_replace(' ', '', $price);
$startPrices = $price;
if($res->getTVValue(27)){
$d = $res->getTVValue(27);
$price = $price - ($price * $d /100);
}
if($res->getTVValue(26)){
$d = $res->getTVValue(26);
$price = $price - $d;
}
$_SESSION['discount'] = $startPrices - $price;
return $price;
}else{
return $price;
}
Answer the question
In order to leave comments, you need to log in
Use this plugin
https://modstore.pro/packages/discounts/mspromocode
There is an option "Apply only to products without old price"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question