open(BRUCE,">bruce.txt"); open(FUCK,">fuck.txt"); open( OPTIONS, "optionsp.txt" ); @options = ; close(OPTIONS); #open( MAP, "map.txt" ); #@map = ; #close(MAP); open( PREVIOUSPRODUCTS, "/aussie/2008/previousproducts/products.txt" ); @previousproducts = ; close(PREVIOUSPRODUCTS); open( PREVIOUSOPTIONS, "/aussie/2008/previousproducts/options.txt" ); @previousoptions = ; close(PREVIOUSOPTIONS); open( PRODUCTS, "products.txt" ); @products = ; close(PRODUCTS); open( PRODUCTSI, ">productsi.txt" ); open( OPTIONSI, ">optionsi.txt" ); open( PRODUCTSNOMAP, ">productsnomap.txt" ); open( OPTIONSNOMAP, ">optionsnomap.txt" ); #open( BCN, "bcn.txt" ); #@bcn = ; #close(BCN); print PRODUCTSI "sku title description gst supplier price wholesale discount departments groups subgroups image size option_type gift_cert related featured url image_2 email_year inactive thumb shipping_rate comment quantity bullet_header bullet_one bullet_two bullet_three bullet_four bullet_five bullet_six bullet_seven bullet_eight bullet_nine bullet_ten bullet_eleven bullet_twelve bullet_thirteen bullet_fourteen bullet_fifteen bullet_sixteen weight model_number sale_price\n"; print OPTIONSI "code\tsku\to_group\to_sort\to_default\to_label\to_value\to_widget\to_height\to_width\tdescription\tprice\twholesale\tdisplay_type\tweight\tcodes\n"; print PRODUCTSNOMAP "sku title description gst supplier price wholesale discount departments groups subgroups image size option_type gift_cert related featured url image_2 email_year inactive thumb shipping_rate comment quantity bullet_header bullet_one bullet_two bullet_three bullet_four bullet_five bullet_six bullet_seven bullet_eight bullet_nine bullet_ten bullet_eleven bullet_twelve bullet_thirteen bullet_fourteen bullet_fifteen bullet_sixteen weight model_number sale_price\n"; print OPTIONSNOMAP "code\tsku\to_group\to_sort\to_default\to_label\to_value\to_widget\to_height\to_width\tdescription\tprice\twholesale\tdisplay_type\tweight\tcodes\n"; #open( BCN, "addgst.txt" ); #@bcn = ; #close(BCN); $i = 0; foreach $p (@products) { chomp $p; @arp = split( /\t/, $p ); $sku = $arp[0]; if ( $i gt 0 ) { $title = $arp[1]; $description = $arp[2]; $gst = $arp[3]; $supplier = $arp[4]; $price = $arp[5]; $wholesale = $arp[6]; $discount = $arp[7]; $departments = $arp[8]; $groups = $arp[9]; $subgroups = $arp[10]; $image = $arp[11]; $size = $arp[12]; $option_type = $arp[13]; $gift_cert = $arp[14]; $related = $arp[15]; $featured = $arp[16]; $url = $arp[17]; $image_2 = $arp[18]; $email_year = $arp[19]; $inactive = $arp[20]; $thumb = $arp[21]; $shipping_rate = $arp[22]; $comment = $arp[23]; $quantity = $arp[24]; $bullet_header = $arp[25]; $bullet_one = $arp[26]; $bullet_two = $arp[27]; $bullet_three = $arp[28]; $bullet_four = $arp[29]; $bullet_five = $arp[30]; $bullet_six = $arp[31]; $bullet_seven = $arp[32]; $bullet_eight = $arp[33]; $bullet_nine = $arp[34]; $bullet_ten = $arp[35]; $bullet_eleven = $arp[36]; $bullet_twelve = $arp[37]; $bullet_thirteen = $arp[38]; $bullet_fourteen = $arp[39]; $bullet_fifteen = $arp[40]; $bullet_sixteen = $arp[41]; $weight = $arp[42]; $model_number = $arp[43]; $sale_price = $arp[44]; $j = 0; $wholesale=~s/  //g; $wholesale=~s/ //g; $price=~s/  //g; $price=~s/ //g; $description=~s/ / /g; if ($sku eq "leimo") { $discount=0.9227799; } ############### FIX PERTH CODES if (($supplier !~ /A-Z/) && ($supplier !~ /\// )) { $supp = sprintf("%05d", $supplier); } $num=""; $numeric=""; $text=""; if ($supplier =~ /(\d*)([A-Z]*)/) { $numeric=$1; $text=$2; $num = sprintf("%05d", $numeric); $supp=$num.$text; } if ($supplier =~ /(\d*)(\/\d)/) { $numeric=$1; $text=$2; $num = sprintf("%05d", $numeric); $supp=$num.$text; } # 17001BONUS # 60500/1 ############### if ($wholesale eq "") { $wholesale=0; } $related=""; $inactive=""; if ($price eq "") { $price=0; } $comment =~ s/\n/\/g; $comment =~ s/\r//g; $comment =~ s/ /\/g; $comment =~ s/ / /g; $comment =~ s/\t/ /g; $comment =~ s/\n/\/g; $comment =~ s/ / /g; $comment =~ s/\s/ /g; $comment =~ s/\r//g; $discount =~ s/ / /g; $discount =~ s/\t/ /g; $discount =~ s/\n/\/g; $discount =~ s/ / /g; $discount =~ s/\s/ /g; $description =~ s/ / /g; $description =~ s/\t/ /g; $description =~ s/\n/\/g; $description =~ s/ / /g; $description =~ s/\s/ /g; if ($supp eq "00000") { $supp=""; } if ($supp eq "0") { $supp=""; } if ($discount eq "") { $discount=0.9; } if ($price eq "") { $price=0; } #$wholesale=80; #$weight=0.1; #$discount=0.8; #$price=100; if (($price !~/(\d+)\.(\d+)/) && ($price !~/\d+/) && ($price !~/\.\d+/)) { #print BRUCE "$sku\t$description\t$price\n"; } #$gst=1; #$supp=12345; if (!$image) { $image="image coming soon.jpg"; } if (!$thumb) { $thumb="image coming soon.jpg"; } $deleted=""; if ($supp eq "66231") { $deleted=1; } if ($supp eq "38473") { $deleted=1; } if ($supp eq "14751") { $deleted=1; } if ($sku eq "nhs-colostrum") { $deleted=1; } if (($subgroups eq "Morlife") && ($description=~/200g/)) { #print "$sku\t$description\n"; $deleted=1; } if (($subgroups eq "Leimo") && ($sku ne "leimo")) { $discount=0.79; } if (($subgroups eq "Suttons")) { # remove discount $discount=0.65; } if (($subgroups eq "Muscletech")) { $discount=0.65; } if (($subgroups eq "Gaspari Nutrition")) { $discount=0.65; } if (($subgroups eq "Inner Armour")) { $discount=0.65; } if (($subgroups eq "Redbak")) { $discount=0.55; } if (($subgroups eq "Ladybird")) { $discount=0.55; } if (($subgroups eq "Black Widow")) { $discount=0.55; } if (($subgroups eq "Natural Health Supplements")) { $discount=0.55; } if (($subgroups eq "Carb Up")) { $discount=0.55; } if (($subgroups eq "Mediterana")) { $discount=0.9; } if (($subgroups eq "Interactive Nutrition")) { $discount=0.8; } if (($description ne "description") && ($deleted ne 1)) { print PRODUCTSNOMAP "$sku $title $description $gst $supp $price $wholesale $discount $departments $groups $subgroups $image $size $option_type $gift_cert $related $featured $url $image_2 $email_year $inactive $thumb $shipping_rate $comment $quantity $bullet_header $bullet_one $bullet_two $bullet_three $bullet_four $bullet_five $bullet_six $bullet_seven $bullet_eight $bullet_nine $bullet_ten $bullet_eleven $bullet_twelve $bullet_thirteen $bullet_fourteen $bullet_fifteen $bullet_sixteen $weight $model_number $sale_price\n"; } ############# OLD PRODUCTS foreach $prevprod (@previousproducts) { chomp $prevprod; @arrprevprod = split(/\t/,$prevprod); $sp = $arrprevprod[4]; $sk = $arrprevprod[0]; $wh = $arrprevprod[25]; #print "$sp\t$supplier\n"; if (($sp eq $supp) && ($supp ne "") # && ($wh eq "PH") && ($bullet_header eq "PH")) { $sku = $sk; #print "$sku $supp\n"; } } ############# OLD OPTIONS if ($supplier eq "") { foreach $o (@options) { chomp $o; @or=split(/\t/,$o); if ($or[1] eq $sku) { $sups=$or[15]; @su=split(/\,/,$sups); foreach $supl (@su) { chomp $supl; if ($supl=~/(.*)=(.*)/) { $cd=$2; ################## foreach $oo (@previousoptions) { chomp $oo; @oor=split(/\t/,$oo); $ooptions=$oor[15]; @oopt=split(/\,/,$ooptions); foreach $ew (@oopt) { chomp $ew; if ($ew=~/(.*)=(.*)/) { $cood=$2; } if (($cd eq $cood) # && ($wh eq "PH") && ($bullet_header eq "PH")) { #if ($sku !~/[a-z]/) { $skoo=$sku; $sku=$oor[1]; } } } } ################## } } } } } ############# #if ($sku !~ /[a-z]/) #{ #foreach $ma (@map) #{ #chomp $ma; #@mm=split(/\t/,$ma); #if (($sku eq $mm[0]) && ($sku ne "sku") && ($sku ne "")) #{ #if ($mm[1] ne "") #{ #$sku=$mm[1]; #} #} #} #} if (($subgroups eq "Body Ripped") && (!$option_type)) { #print #"$description $option_type $price $wholesale $discount\n"; #print #"$description $option_type $price $wholesale $discount\n"; if ($wholesale > 0) { $pro=(($price*$discount-($wholesale*1.1))/($wholesale*1.1)); #print "$description\t$pro\n"; $brprofit=0.12; $dis=(1.1*($brprofit+1)*$wholesale)/$price; #print "$brprofit $wholesale $price\n"; #print "$sku\t$description\t$dis\t$discount\n"; $discount=$dis; } else { print "-------------\n$sku\n--------------\n"; } } if (($description ne "description") && ($deleted ne 1)) { if ($gst eq 0) { $gst=""; } #2896 testoroid Testoroid 60t $69 $89.95 if ($sku eq "testoroid") { $discount=69/89.95; } print PRODUCTSI "$sku $title $description $gst $supp $price $wholesale $discount $departments $groups $subgroups $image $size $option_type $gift_cert $related $featured $url $image_2 $email_year $inactive $thumb $shipping_rate $comment $quantity $bullet_header $bullet_one $bullet_two $bullet_three $bullet_four $bullet_five $bullet_six $bullet_seven $bullet_eight $bullet_nine $bullet_ten $bullet_eleven $bullet_twelve $bullet_thirteen $bullet_fourteen $bullet_fifteen $bullet_sixteen $weight $model_number $sale_price\n"; } } $i++; } $i = 0; foreach $o (@options) { chomp $o; #print OPTIONS "code sku o_group o_sort o_default o_label o_value o_widget o_height o_width description price wholesale display_type weight\n"; @ar = split( /\t/, $o ); $code = $ar[0]; $skux = $ar[1]; $o_group = $ar[2]; $o_sort = $ar[3]; $o_default = $ar[4]; $o_label = $ar[5]; $o_value = $ar[6]; $o_widget = $ar[7]; $o_height = $ar[8]; $o_width = $ar[9]; $description = $ar[10]; $price = $ar[11]; $wholesale = $ar[12]; $display_type = $ar[13]; $weight = $ar[14]; $codes = $ar[15]; if ( $i gt 0 ) { $j = 0; $counter=0; foreach $b (@bcn) { chomp $b; @array = split( /\t/, $b ); #sku gst description option weight price wholesale $skum = $array[0]; if ( ( $j > 0 ) && ( $skux eq $skum ) ) { $gst = $array[1]; $desc = $array[2]; $option = $array[3]; $w = $array[4]; $pr = $array[5]; $whol = $array[6]; $description = $desc; #print "$o_value\n"; #code sku o_group o_sort o_default o_label o_value o_widget o_height o_width description price wholesale display_type weight codes #1 472 Flavour&Quantity Flavour & Quantity 1.25kgStrawberryDelight=1.25 kg Strawberry Delight,2.5kgStrawberryDelight=2.5kg Strawberry Delight,4kgStrawberryDelight=4 kg Strawberry Delight,1.25kgBananaSmoothie=1.25kg Banana Smoothie,2.5kgBananaSmoothie=2.5kg Banana Smoothie,4kgBananaSmoothie=4kg Banana Smoothie,1.25ChocolateMousse=1.25 Chocolate Mousse,2.5kgChocolateMouse=2.5kg Chocolate Mouse,4kgChocolateMousse=4kg Chocolate Mousse,1.25kgVanillaCream=1.25kg Vanilla Cream,2.5kgVanillaCream=2.5kg Vanilla Cream,4kgVanillaCream=4kg Vanilla Cream,1.25Cookies&Cream=1.25 Cookies & Cream,2.5kgCookies&Cream=2.5kg Cookies & Cream,4kgCookies&Cream=4kg Cookies & Cream select 0 0 description 1.25kgStrawberryDelight=69.95,2.5kgStrawberryDelight=124.95,4kgStrawberryDelight=199.95,1.25kgBananaSmoothie=69.95,2.5kgBananaSmoothie=124.95,4kgBananaSmoothie=199.95,1.25ChocolateMousse=69.95,2.5kgChocolateMouse=124.95,4kgChocolateMousse=199.95,1.25kgVanillaCream=69.95,2.5kgVanillaCream=124.95,4kgVanillaCream=199.95,1.25Cookies&Cream #print "$sku\t$desc\t$option\t$w\t$pr\t$whol\n"; $nospaces = $option; $nospaces =~ s/ //g; #print "$nospaces\n"; #print "$nospaces\n"; #print "$o_value $counter\n"; if ($counter eq 0) { $weight=""; $o_value=""; $wholesale=""; $price=""; #$nospaces=""; } $weight = "$weight" . "$nospaces" . "=" . "$w" . "\,"; $price = "$price" . "$nospaces" . "=" . "$pr" . "\,"; $wholesale = "$wholesale" . "$nospaces" . "=" . "$whol" . "\,"; $o_value = "$o_value" . "$nospaces" . "=" . "$option" . "\,"; $counter++; #print "$weights\n"; } $j++; } $weight =~ s/\,$//; $o_value =~ s/\,$//; $wholesale =~ s/\,$//; $price =~ s/\,$//; $nospaces =~ s/\,$//; if ($wholesale) { #print "$wholesale\n"; } $o_value=~s/ / /g; print OPTIONSNOMAP "$code $skux $o_group $o_sort $o_default $o_label $o_value $o_widget $o_height $o_width $description $price $wholesale $display_type $weight $codes\n"; ####################### @or=split(/\t/,$o); if ($or[1] eq $skux) { $sups=$or[15]; @su=split(/\,/,$sups); foreach $supl (@su) { chomp $supl; if ($supl=~/(.*)=(.*)/) { $cd=$2; ################## foreach $oo (@previousoptions) { chomp $oo; @oor=split(/\t/,$oo); $ooptions=$oor[15]; @oopt=split(/\,/,$ooptions); foreach $ew (@oopt) { chomp $ew; if ($ew=~/(.*)=(.*)/) { $cood=$2; } if (($cd eq $cood) ) { #if ($sku !~/[a-z]/) { $sku=$oor[1]; $skux=$sku; } } } } } } } ####################### #print "$skux\n"; print OPTIONSI "$code $skux $o_group $o_sort $o_default $o_label $o_value $o_widget $o_height $o_width $description $price $wholesale $display_type $weight $codes\n"; $weight=""; $o_value=""; $wholesale=""; $price=""; $nospaces=""; } $i++; } close(OPTIONSI); close(PRODUCTSI); close(OPTIONSNOMAP); close(PRODUCTSNOMAP); close(BRUCE); close(FUCK);