'); $xml -> addChild( 'title', 'abexil' ); $xml -> addChild( 'updated', date( 'Y-m-d' ) ); foreach ( $array['products']['product'] as $product ) { foreach ( $product['sizes'] as $size ) { $productXml = $xml -> addChild( 'entry' ); $productXml -> addChild( 'g:id', $product['@attributes']['id'], 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:gtin', $size['@attributes']['code_producer'], 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:title', $product['description']['name'][0] . ' (' . $size['@attributes']['name'] . ')', 'http://base.google.com/ns/1.0' ); $stock = false; foreach ( $size['stock'] as $stock ) if ( $stock['@attributes']['stock_quantity'] > 0 ) $stock = true; $productXml -> addChild( 'g:availability', $stock ? 'in_stock' : 'out_of_stock', 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:brand', $product['producer']['@attributes']['name'], 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:link', $product['card']['@attributes']['url'], 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:image_link', $product['images']['large']['image']['@attributes']['url'], 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:description', $product['description']['short_desc'], 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:product_type', $product['category_idosell']['@attributes']['path'], 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:condition', 'new', 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:price', $product['srp']['@attributes']['gross'] . ' PLN', 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:sale_price', $product['price']['@attributes']['gross'] . ' PLN', 'http://base.google.com/ns/1.0' ); $productXml -> addChild( 'g:google_product_category', $product['category_idosell']['@attributes']['id'], 'http://base.google.com/ns/1.0' ); } } $xml -> asXML( "abexil.xml"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = $settings['email_host']; $mail->Port = $settings['email_port']; $mail->Username = $settings['email_login']; $mail->Password = $settings['email_password']; $mail->CharSet = "UTF-8"; $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); $mail -> AddReplyTo( 'biuro@project-pro.pl' ); $mail -> SetFrom( 'www@cdn.projectpro.pl', 'www@cdn.projectpro.pl' ); $mail -> AddAddress( 'biuro@project-pro.pl', '') ; $mail -> Subject = 'Abexil.pl - uruchomiono cron - ' . date(' Y-m-d H:i:s' ); $mail -> Body = '

Abexil.pl - uruchomiono cron - ' . date(' Y-m-d H:i:s' ) . '

'; $mail->IsHTML(true); $mail->Send(); echo 'Abexil.pl - uruchomiono cron - ' . date(' Y-m-d H:i:s' ); ?>