Jump to content

Vixushr

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by Vixushr

  1. Iw found some solution in pearl... can someone help me translate it to php? Say your cronjob spawns a process with the commandline "/usr/sbin/larch.pl /etc/trees.conf", then you could add a cronjob like this: Code: #!/bin/sh # Sleep for 30 seconds. sleep 30s # Find process by commandline and -KILL it. pkill -9 -f "/usr/sbin/larch.pl /etc/trees.conf" # Exit the shellscript the right way. exit 0 It should be scheduled to run at the same interval as your other cronjob.
  2. If i unedrstaind you correctly i will have a case that cron wont run my job becouse it is allready in active state. But i need my cron to run jobs as it shud but i need to kill all remaiming tasks that are for some reason still active. Thanx.
  3. Helo dear people. I have a following problem, i got script that calls xml data from remote servers and it is set on cron job in cpanel. It works ok... but from time to time job's tend to remain active and when i reach my limit (20 tasks) entire site is shut by my host. Is there a way to create php script that can be called by cron job (after my script) to close / kill all active tasks. Thanx!
  4. Thanx mate, easy and eficient. Can i offer you a paypall beer?
  5. Can anyone help me??? I assume that i need some if else but i cant get it right... I was trying to add this: if ($row['quantity'] >= 5) { $return = "5"; } else { $return = $row['quantity']; } But it wont work...
  6. Uh i see a small error, this piece of my text ended in code section. and theres no more modify button. So here it is! I need to hide quantity that is greather than 5 pieces. So that all quantity that is >= equal or larger than 5 is shown in XML as 5. eg. if quantity is 129 in xml is reported as 5. Can anyone help me out with this!? BR
  7. Helo dear people, I need some help with piece of code that generates XML This all works as is: include(dirname(__FILE__).'/config/config.inc.php'); require_once(dirname(__FILE__).'/init.php'); error_reporting(0); $p=Product::getProducts(7, 0, 0, 'id_product', 'desc', false); $products=Product::getProductsProperties(7, $p); header("Content-Type: text/xml\n\n"); //print "Content-type: text/html\n\n"; echo '<?xml version="1.0" encoding="utf-8"?> <Catalog>'; foreach ($products as $row) { if ($row['active']){ $img=Product::getCover($row['id_product']); echo ' <products> <code>'.str_replace("&", "&", $row['id_product']).'</code> <name>'.str_replace("&", "&", $row['name']).'</name> <descr>'.str_replace("&", "and", strip_tags($row['description_short'])).'</descr> <price>'.($row['price']*1).'</price> <quantity>'.str_replace("&", "&", $row['quantity']).'</quantity> <categ>'.str_replace("&", "&", $row['category']).'</categ> <link>http://www.xxxxx.hr'.$row['link'].'</link> <img>http://www.xxxxx.hr/xxxxx/'.$shopUrl.'img/p/'.$row['id_product'].'-'.$img['id_image'].'.jpg</img> </products>'; } } echo '</Catalog>'; ?>code] But now i need to hide quantity if its larger that 5 pieces. So that all quantity that is >= equal or larger of 5 si shown in XML as 5. Can anyone help me out with this!? :'( BR Vixus
  8. Helo dear people, I need some halp with mine script. This is part of it that works: function msan_getxmlinfo() { //global $local; //msan_download(); $path = dirname(__FILE__).'/xml/pricelist.xml'; $doc = new DOMDocument(); $doc->load($path); $msan = $doc->getElementsByTagName( "Table" ); $result = array(); foreach( $msan as $table ) { $codes = $table->getElementsByTagName( "ProductCode" ); $code = $codes->item(0)->nodeValue; $prices = $table->getElementsByTagName( "ProductPartnerPrice" ); $price = $prices->item(0)->nodeValue; $price = sprintf('%6f',$price); $availables = $table->getElementsByTagName( "ProductAvailability" ); $available = $availables->item(0)->nodeValue; $result[$code] = array('code'=>$code,'price'=>$price,'available'=>$available); } //echo "<pre>"; //print_r($result); //@unlink($path); return $result; } But now i need to insert one more element called "ProductDiscount" And aditional condition for proper price setting related so that when "ProductDiscount" is 0 (zero) then increase price by 3% and if theres any other value than 0 (zero) leave price as is. I was trying somthing like this but i cant get price increase: function msan_getxmlinfo() { $path = dirname(__FILE__).'/xml/pricelist.xml'; $doc = new DOMDocument(); $doc->load($path); $msan = $doc->getElementsByTagName( "Table" ); $result = array(); foreach( $msan as $table ) { $codes = $table->getElementsByTagName( "ProductCode" ); $code = $codes->item(0)->nodeValue; $prices = $table->getElementsByTagName( "ProductPartnerPrice" ); $price = $prices->item(0)->nodeValue; $discounts = $table->getElementsByTagName( "ProductDiscount"); if($discounts->item(0)=="0") { $price = $price*1.03; } else { $price = $prices->item(0)->nodeValue; } $price = sprintf('%6f',$price); $availables = $table->getElementsByTagName( "ProductAvailability" ); $available = $availables->item(0)->nodeValue; $result[$code] = array('code'=>$code,'price'=>$price,'available'=>$available,'discount'=>$discount); } return $result; } Help needed!
  9. Thank you mate. PERFECT!
  10. Helo, I need help with mine script. It downloads xml from distant server and all works ok but i need help to change something on that downloaded xml. It contains element (column) that has products names and its called "products". in there i have products code names and i have specific situation where i get products codes in form like this "AA123BB#CCC". I need to somehow strip or delete or atleest ignore in further querry symbol "#" and everything after it. In this case i need to remove "#CCC" so that my column has only first part of data "AA123BB". Help needed!!! Thanx!
  11. I have range of categories from 1 to 999 With this is piece of code: foreach (range(96,204) as $number) if (Tools::getValue('id_category') == $number) return; $this->filterResults(); return $this->display( __FILE__, 'block-center-filter.tpl'); iw managed to avoid display of 'block-center-filter.tpl' in that range but it shows in every other categories. What i need is opposite... i would like to dont show except in that range... how to do that?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.