Professional Documents
Culture Documents
38 Refinement by MVS to create subroutines #1.37 Removed maximum Drop from Script - commented out in case we want to add it again. Kept price from #going up more than 2x #1.36 over14 days bug if it is 0 then it won't re price books that are not yet l isted. #1.35 found bug with over14 days. #1.34 added ability to re price mass paperbacks if older than 180 days #1.33 Bug when a book was looking for under 14 days. If it wasn't listed yet it was under 14 days...duh. #Changed to look to see if it is 0 days...it isn't listed yet #1.32 Excluded DVD/CD's from re pricing. Also excluded books from being re price d if less than 14 days. #1.31 AOB has bug with listDate if we haven't listed yet. This was causing non-l isted books to show up listed #longer than 180 days. #1.30 bug needed to set ourBooksLowestPrice if a condition better was found chea per. #1.29 Allowed acceptable books to be re priced and offers compared. #1.28 Added function to re price above condition if we didn't have a price in ou r condition #1.27 added the no_manual_reprice flag if we change the price #1.26 changed the lowest price of a condition above ours to 65% of lowest listin g so that we ensure we are always 35% #lower then the rank above us. #1.25 changed minimum new to .99....book over 180 days will get bumped down one condition so it prices and moves. #Rating cut off changed to 250,000 from 500,000 #1.24 Changed multiplier to X2 for books that we found no price to match #1.21 fixed bug determining what is a hardbound book #1.22 changed the price of hardbound books to .99 # #***********************Definitions******************************************** ################ These are used incase there are no other items ################ ######## $min_new_price = 4.99; #Minimum New Price used for no other ite ms to compete against $min_new_oz_price = 5.99; #Minimum New Oversized Price $min_ln_price = 2.99; #Minimum Used:Like New Price $min_ln_oz_price = 3.99; #Minimum Used:Like New Oversized Price $min_vg_price = 1.99; #Minimum Used:Very Good Price $min_vg_oz_price = 2.99; #Minimum Used:Very Good Oversized Price $min_g_price = .99; #Minimum Used:Good Price $min_g_oz_price = 1.99; #Minimum Used:Good Oversized Price $min_a_price = .99; #Minimum Used:Acceptable Price $min_a_oz_price = 1.99; #Minimum Used:Acceptable Oversized Price $aged_days = 180; #Set this to the number of days you want to use for changing aging. #our minimums for types of books $min_hardBack = .99; #Minimum of a hard back book. $min_hardBack_180 = .01; #Minimum of hardback book after 180 days. $min_paperBack = .99; #Minimum of a paper back $min_paperBack_180 = .01; #Minimum of a paper back after 180 days. $min_new_180 = .01; #Minimum of a new Book after 180 days. $ratingCutoff = 250000; #Cut off for different sales rating minimums
$maximumDrop = .65;
#This is the maximum drop from our current price... #if the amount of new_pr ice is greater than .65 X OurCurrentPrice then leave current price alone. $maximumCDDrop = .80; #this is the maximum drop from our current price for CD/DVD's $min_Price_RankValue = 5000000;#Above this rank, the price sets to minimum $min_price_3yr_over_above5000000 = 0.01;#minimum Price over 3 yrs and above rank 5000000 $min_price_3yr_over_low5000000 = 0.99;#minimum Price over 3 yrs and below rank 5 000000 $min_price__a_g_above5000000 = 0.99;#minimum Price above rank 5000000 and accept able or good $min_price__ln_vg_above5000000 = 0.99;#minimum Price above rank 5000000 and like new or verygood #############################################################################33 # These are for the TODO of pricing DVD's/CD's Should follow same guidlines of b ooks ### $min_DVD = .99; #Minimum DVD Price $min_DVD_180 = .01; #Minimum DVD Price after 180 days. $min_CD = .99; #Minimum CD Price $min_CD_180 = .01; #Minimum CD Price after 180 days. ################################################################################ ################# ################# These are my definitions for easier manipulation ############# ################# $signedBookMultipler = .65; #Multiplier for signed books $excludeBookMaxPrice = 50; #Used to exclude books with this price or above from repricing. $isBookOversized = 0; #Flag to tell us if this book is oversiz ed $isBookHard = 0; #Flag to tell us if this item is a hardback or not $isBookSigned = 0; #Flag to tell us status of signe d $ageOfOurListing = 0; #Flag for listing age $Over14Days = 0; #Flag for over 14 days $rateIndex; #Index used with the arrays of offers. Set by th e rating cutoff number @source_ignore_string=("Erin","CONSIGNED"); #Used to ignore in source- change th is if you want to ignore another source #if their are no other items to compare against, make minimum be 2x minimum cond ition #******************************Values****************************************** $my_price = $market->{my_item}->{core_price}; $my_cond = $market->{my_item}->{condition}; $my_source = $market->{my_item}->{source}; $my_ch = $c_h{$my_cond}; $amz_price = 0; #Clear Amazon Price $salesRank = $market->{sales_rank}; rom Amazon if ($salesRank < $ratingCutoff) { $rateIndex = 1; } else { $rateIndex = 0; } #My Price #My Condition #My Source
#sales ranking f
#******************************** Common Prints ******************************** ***** #print out the version $v->{comments} .= sprintf(qq[Running Version %1.2f<br>],$ourVersion); #Display Amazon Sales Rank $v->{comments} .= sprintf(qq[Sales rank = %1d<br>],$salesRank); #Display our current price $v->{comments} .= sprintf(qq[Our Current price = %1.2f<br>],$my_price); #Display Condition $v->{comments} .= sprintf(qq[This book is %1d<br>],$my_cond); #******************************************************************************* ******* #Oversized books have a minimum. if(($market->{my_item}->{notes} =~ /oversized/i) || ($market->{my_item}->{P0} =~ /oversized/i)) { $isBookOverSized = 1; $v->{comments} .= qq[This is an Oversized Book<br>]; #3_13 don't return....go through and price but make sure it has a minimum of the oversized price. return $v; } #Signed books have a multiplier. if(($market->{my_item}->{notes} =~ /Signed/i) or ($market->{my_item}->{Signature} =~ /Signed/i) or ($market->{my_item}->{Keyword} =~ /Signed/i)) { $isBookSigned = 1; $v->{comments} .= qq[This is a Signed Book<br>]; } #Type of book. 1 = Hardback 0 = Softback(default) #note: Is paper back if this i s not true if(($market->{my_item}->{media} =~ /hardcover/i) || ($market->{my_item}->{media} =~ /hard cover/i) || ($market->{my_item}->{media} =~ /unknown/i)) { $isOurBookHard = 1; $v->{comments} .= qq[This is a Hardback Book<br>]; } elsif(($market->{my_item}->{media} =~ /paperback/i) or ($market->{my_item}->{media} =~ /softcover/i)) { $isOurBookHard = 0; $v->{comments} .= qq[This is a Paperback Book<br>]; } elsif(($market->{my_item}->{media} =~ /dvd/i) or ($market->{my_item}->{media} =~ /cd/i)) { $isThisDVD_CD = 1; $v->{comments} .= qq[This is a CD/DVD<br>]; } #determine where we got this book $inventory_source = $market->{my_item}->{source}; $v->{comments} .= qq[Inventory source = $inventory_source<br>]; #Display How long book has been listed #setting the age of our book in days if ($market->{my_item}->{listed_time} > 0) { $ageOfOurListing = ($market->{my_item}->{current_time} - $market->{my_item}->{listed_t ime})/86400; } else { $ageOfOurListing = 0; } #determine if this is over 180 and 14 days.
if( $ageOfOurListing > 14 ) { $Over14Days = 1; $v->{comments} .= qq[This Book is over 14 days<br>]; } else { $Over14Days = 0; $v->{comments} .= qq[This Book is less than 14 days<br>]; } #if the age of our book is 0 this means we haven't listed yet. So we need to tur n over14days on so we can get it manually listed #this is a hack and I'm not sure how to fix it because we can't tell if it has b een listed yet or not...sigh if($ageOfOurListing == 0) { # So ageOfOurListing is needs to be 14 days $ageOfOurListing = 14; } if( $ageOfOurListing > $aged_days ) { $Over180Days = 1; } else { $Over180Days = 0; } $v->{comments} .= sprintf(qq[Our Book has been listed for %1d days<br>], $ageOfO urListing); #set whether this is a heavy book over 16 oz if($market->{my_item}->{weight} > 16) { $isOurBookHeavy = 1; $v->{comments} .= sprintf(qq[Our Book is Heavy<br>]); } #Our condition of the book $my_cond = $market->{my_item}->{condition}; #We reset the levels going from worse to best 1 - 4 ... 4 being the best as in N EW! if ( $isBookOverSized == 1) { if ( $my_cond == 1 ) { $MinPrice = $min_a_oz_price; } elsif ( $my_cond == 2 ) { $MinPrice = $min_g_oz_price; } elsif ( $my_cond == 3 ) { $MinPrice = $min_vg_oz_price; } elsif ( $my_cond == 4 ) { $MinPrice = $min_ln_oz_price; } } else { if ( $my_cond == 1 ) { $MinPrice = $min_a_price; } elsif ( $my_cond == 2 ) { $MinPrice = $min_g_price; } elsif ( $my_cond == 3 ) { $MinPrice = $min_vg_price; } elsif ( $my_cond == 4 ) { $MinPrice = $min_ln_price; } } #$v->{comments} .= sprintf(qq[Our Book has been minimum Price %1d days<br>], $Mi nPrice); if ( $isBookSigned == 1 ) { $new_price = $my_price * $signedBookMultipler + $my_price; $v->{price}->{core} = $new_price; $v->{comments} .= sprintf ( qq[Changing to Price %1.2f because book is s igned<br> ], $new_price);
$v->{changed} = 'y'; return $v; } #Our condition of the book $my_cond = $market->{my_item}->{condition}; #We reset the levels going from worse to best 1 - 4 ... 4 being the best as in N EW! if( $my_cond == 11 ) { $ourBookConditionLevel = 4; } elsif ( $my_cond == 4 ) { $ourBookConditionLevel = 0; #3_29_10 } elsif ( $my_cond == 3 ) { $ourBookConditionLevel = 1; } elsif ( $my_cond == 2 ) { $ourBookConditionLevel = 2; } elsif( $my_cond == 1 ) { $ourBookConditionLevel = 3; } #if we have had this book for more than 180 days then bump down condition of lik e new to very good and very good to good. if( $Over180Days == 1 ) { if ($ourBookConditionLevel == 4) { $ourBookConditionLevel = 3; } elsif( $ourBookConditionLevel == 3 ) { $ourBookConditionLevel = 2; } elsif ( $ourBookConditionLevel == 2 ) { $ourBookConditionLevel = 1; } else { $ourBookConditionLevel = 0; } } $v->{comments} .= sprintf(qq[Our Books level is %1d<br>], $ourBookConditionLevel ); #used or New "U" I don't like this so setting another...note this can be "C" whi ch means collector too. $my_ch = $c_h{$my_cond}; #set new if condition is 11 if( $my_cond == 11 ) { $isOurBookNew = 1; } #*********************Exclusions****************************************** #This has to be here for some reason if ( $market->{my_item}->{autoreprice_exclude} eq 'y') { $v->{changed} = 'n'; $v->{comments} .= "<b>Excluded from Auto Repricing</b><br>"; return $v; } # Exclude if our source has our ignore source words (These words are passed in s ource ignore string) $v = excludeIfIgnoreStringFound($inventory_source, @source_ignore_string, $v); # If we have DNR in P2 variable return if ( $market->{my_item}->{p2} =~ /DNR/i ) { $v->{comments} .= qq[Excluding since we have DNR in the P2 variable<br>]; if( $v->{no_manual_reprice} != 1 ){ $v->{no_manual_reprice} = 1; $v->{changed} = 'y'; }
return $v; } # Exclude books that are less than 14 days if( $Over14Days == 0 ){ #item is 14 or under days. $v->{comments} .= qq[Excluding since this book hasn't been listed for more t han 14 days<br>]; if( $v->{no_manual_reprice} != 1 ){ $v->{no_manual_reprice} = 1; $v->{changed} = 'y'; } return $v; } # Exclude via price greater than excludeBookMaxPrice if ( ( $market->{my_item}->{core_price} > $excludeBookMaxPrice ) && (!$market->{my_item}->{slp_mode} )) { $v->{comments} .= qq[Excluding since price is greater than than $excludeBook MaxPrice<br>]; if( $v->{no_manual_reprice} != 1 ) { $v->{no_manual_reprice} = 1; $v->{changed} = 'y'; } return $v; } #TODO - reprice DVD's/CD's differently....for now we won't price them. if( $isThisDVD_CD == 1 ) { $v->{comments} .= qq[Excluding since this is a DVD/CD<br>]; if( $v->{no_manual_reprice} != 1 ) { $v->{no_manual_reprice} = 1; $v->{changed} = 'y'; } return $v; } # Exclude condition class: Collectable if ($my_ch eq 'C') { $v->{comments} .= qq[Exluding since condition class is collectible<br>]; if( $v->{no_manual_reprice} != 1 ) { $v->{no_manual_reprice} = 1; $v->{changed} = 'y'; } return $v; } ########Code from the previous logic , if you need, then keep this ############# # # __________________All Offers__________________________________________________ ____ # # @o_list = (); @o_like_new = (); @o_new = (); @o_good = (); @o_very_good = (); @o_acceptable = (); OFFERS: foreach my $o ( @{$market->{offers}} ) {
# # Exclude Acceptables # #3_29_10 allowed acceptable next if ( ( $o->{condition} == 4 ) || ( $o->{con dition} == 8 ) ); next if ( $o->{condition} == 8 ); # # Exclude our books from the offers # next if ( $o->{nickname} =~ /^(rrbooksca)$/i ); # # Exclude via condition class is collectible # next if $c_h{$o->{condition}} eq 'C'; # switch on the type of condition and add to the array = we have arrays for each type of book condition $found = 0; if ( $o->{condition} == 4 ) { $found = offerPriceFound(@o_acceptable, $o->{price},$found); if( $found == 0 ) { push @o_acceptable, $o; } } elsif ( $o->{condition} == 1) { $found = offerPriceFound(@od_like_new, $o->{price},$found); if( $found == 0 ) { push @o_like_new, $o; } } #very Good elsif ( $o->{condition} == 2) { $found = offerPriceFound(@o_very_good, $o->{price},$found); if( $found == 0 ) { push @o_very_good, $o; } } #Good elsif ( $o->{condition} == 3 ) { $found = offerPriceFound(@o_good, $o->{price},$found); if( $found == 0 ){ push @o_good, $o; } } #Darn thing is spank'n brand new elsif ( $o->{condition} == 11 ) { $found = offerPriceFound(@o_new, $o->{price},$found); if( $found == 0 ) { push @o_new, $o; } } } #end of all offers # #______________Determine the correct price for this book________________________ _______________ # $new_price = 0.00; #if this is a new book if( $isOurBookNew ) { if ( defined ( $o_new[0] ) ) {
#If we found any new book offers. [0] is the lowest book price. #TODO If we have more than 5 of this new book in inventory then be the l owest dude. #Need to find the $v->{QtyArgument} in their script if( defined ( $o_new[$rateIndex] ) ) { #3_13 took this out...not sure why put it in ?? --if( $ourCurrentPri ce > $o_new[$rateIndex]->{price} ){ $new_price = $o_new[$rateIndex]->{price}; #set the price of the new book #} } elsif( defined ( $o_new[$rateIndex - 1] ) ) { $new_price = $o_new[$rateIndex - 1]->{price}; } else{ #we have to look at lowest price and raise it up by the lowest a mount * a multiplier #TODO } } } #This is a used book else{ #***************************************************** #find our books lowest price #***************************************************** #acceptable if ( $ourBookConditionLevel == 0 ) { if( defined ($o_acceptable[$ratingIndex]) ) { $ourBookLowestPrice = $o_acceptable[$ratingIndex]->{price}; } elsif ( defined ($o_acceptable[$ratingIndex - 1]) ) { $ourBookLowestPrice = $o_acceptable[$ratingIndex - 1]->{price}; } } #Good elsif ( $ourBookConditionLevel == 1 ) { if( defined ($o_good[$ratingIndex]) ){ $ourBookLowestPrice = $o_good[$ratingIndex]->{price}; } elsif( defined ($o_good[$ratingIndex - 1]) ) { $ourBookLowestPrice = $o_good[$ratingIndex - 1]->{price}; } } #Very Good elsif ($ourBookConditionLevel == 2 ) { if( defined ($o_very_good[$ratingIndex]) ) { $ourBookLowestPrice = $o_very_good[$ratingIndex]->{price}; } elsif( defined ($o_very_good[$ratingIndex - 1]) ) { $ourBookLowestPrice = $o_very_good[$ratingIndex - 1]->{price}; } } #like New elsif ($ourBookConditionLevel == 3 ) { if( defined ($o_like_new[$ratingIndex]) ){ $ourBookLowestPrice = $o_like_new[$ratingIndex]->{price}; } elsif( defined ($o_like_new[$ratingIndex - 1]) ) { $ourBookLowestPrice = $o_like_new[$ratingIndex - 1]->{price}; } } #New
elsif ($ourBookConditionLevel == 4 ) { if( defined ($o_new[$ratingIndex]) ){ $ourBookLowestPrice = $o_new[$ratingIndex]->{price}; } elsif( defined ($o_new[$ratingIndex - 1]) ) { $ourBookLowestPrice = $o_new[$ratingIndex - 1]->{price}; } } else { #couldn't find any price $ourBookLowestPrice = $my_price; $v->{comments} .= qq[Price was set to our current price because nothing found in same condition<br>]; } $v->{comments} .= sprintf ( qq[OurBookLowestPrice to be found in same condit ion is %1.2f<br>], $ourBookLowestPrice); #***************************************************** #Now we need to find the lowest price for each level. #***************************************************** #level 0 Acceptable if ( defined ($o_acceptable[$rateIndex]) ) { $level0_low = $o_acceptable[$ratingIndex]->{price}; $v->{comments} .= sprintf ( qq[level 0 lowest price to be found is %1.2f <br>], $level0_low); } #level 1 Good if( defined ($o_good[$rateIndex]) ) { $level1_low = $o_good[$ratingIndex]->{price}; $v->{comments} .= sprintf ( qq[level 1 lowest price to be found is %1.2f <br>], $level1_low); } elsif(defined ($o_good[$rateIndex - 1])) { $level1_low = $o_good[$ratingIndex - 1]->{price}; $v->{comments} .= sprintf ( qq[level 1 lowest price to be found is %1.2f <br>], $level1_low); } #level 2 Very Good if( defined ($o_very_good[$rateIndex]) ) { $level2_low = $o_very_good[$ratingIndex]->{price}; $v->{comments} .= sprintf ( qq[level 2 lowest price to be found is %1.2f <br>], $level2_low); } elsif(defined ($o_very_good[$rateIndex - 1])) { $level2_low = $o_very_good[$ratingIndex - 1]->{price}; $v->{comments} .= sprintf ( qq[level 2 lowest price to be found is %1.2f <br>], $level2_low); } #level 3 Like new if( defined ($o_like_new[$rateIndex]) ) { $level3_low = $o_like_new[$ratingIndex]->{price}; $v->{comments} .= sprintf ( qq[level 3 lowest price to be found is %1.2f <br>], $level3_low); } elsif(defined ($o_like_new[$rateIndex - 1])) { $level3_low = $o_like_new[$ratingIndex - 1]->{price}; $v->{comments} .= sprintf ( qq[level 3 lowest price to be found is %1.2f <br>], $level3_low); }
#level 4 New if( defined ($o_new[$rateIndex]) ) { $level4_low = $o_new[$ratingIndex]->{price}; $v->{comments} .= sprintf ( qq[level 4 lowest price to be found is %1.2f <br>], $level4_low); } elsif(defined ($o_new[$rateIndex - 1])){ $level4_low = $o_new[$ratingIndex - 1]->{price}; $v->{comments} .= sprintf ( qq[level 4 lowest price to be found is %1.2f <br>], $level4_low); } #***************************************************** #Now start checking pricing of different levels. See if any level (starting from top) is less than our current price #***************************************************** if( $ourBookConditionLevel < 4 && ($level4_low * .65) <= $ourBookLowestPrice && $level4_low != 0 ) { $new_price = $level4_low; $ourBookLowestPrice = $new_price; $v->{comments} .= qq[Book in level 4 found cheaper<br>]; $levelPriceFound = 4; } if( $ourBookConditionLevel < 3 && ($level3_low && $level3_low != 0 ) { if( $level3_low < $new_price ) { $new_price = $level3_low; } #$ourBookLowestPrice = $new_price; $v->{comments} .= qq[Book in level 3 found $levelPriceFound = 3; } if( $ourBookConditionLevel < 2 && ($level2_low && $level2_low != 0 ) { if( $level2_low < $new_price ){ $new_price = $level2_low; } #$ourBookLowestPrice = $new_price; $v->{comments} .= qq[Book in level 2 found $levelPriceFound = 2; } if( $ourBookConditionLevel < 1 && ($level1_low && $level1_low != 0 ) { if( $level1_low < $new_price ){ $new_price = $level1_low; } #$ourBookLowestPrice = $new_price; $v->{comments} .= qq[Book in level 1 found $levelPriceFound = 1; } * .65) <= $ourBookLowestPrice
cheaper<br>];
#***************************************************** #now that we found the lowest price at the level we need to calculate the le vel offset #ie: if we are at 3 and the lowest level is at 4 #(above our condition then we need to use that price times a multiplier) #***************************************************** if ( $new_price != 0 ) #only use the multiplier if the cheaper level was a b etter condition than our condition
{ if( $ourBookConditionLevel - $levelPriceFound == -1 ) { $new_price = $new_price * .65; $v->{comments} .= qq[Higher Level book found that is cheaper calculated using .65 multiplier<br>]; } elsif( $ourBookConditionLevel - $levelPriceFound == -2 ) { $new_price = $new_price * .50; $v->{comments} .= qq[Higher Level book found that is cheaper calculated using .50 multiplier<br>]; } elsif( $ourBookConditionLevel - $levelPriceFound == -3 ) { $new_price = $new_price * .30; $v->{comments} .= qq[Higher Level book found that is cheaper calculated using .30 multiplier<br>]; } elsif( $ourBookConditionLevel - $levelPriceFound == -4 ) { $new_price = $new_price * .20; $v->{comments} .= qq[Higher Level book found that is cheaper calculated using .20 multiplier<br>]; } } #***************************************************** Added 3_29_10 #If we do not have a book in our condition to price against we need to look in condition above #***************************************************** if ( $ourBookLowestPrice == 0 && $new_price == 0 ) { if( $ourBookConditionLevel < 4 && ($level4_low * .65) <= $my_price && $l evel4_low != 0 ) { $new_price = $level4_low * .65; $v->{comments} .= qq[Higher Level book priced used because there was none at our condition<br>]; } elsif( $ourBookConditionLevel < 3 && ($level3_low * .65) <= $my_price && $level3_low != 0 ) { $new_price = $level3_low * .65; $v->{comments} .= qq[Higher Level book priced used because there was none at our condition<br>]; } elsif( $ourBookConditionLevel < 2 && ($level2_low * .65) <= $my_price && $level2_low != 0 ) { $new_price = $level2_low * .65; $v->{comments} .= qq[Higher Level book priced used because there was none at our condition<br>]; } elsif( $ourBookConditionLevel < 1 && ($level1_low * .65) <= $my_price && $level1_low != 0 ){ $new_price = $level1_low * .65; $v->{comments} .= qq[Higher Level book priced used because there was none at our condition<br>]; } } #***************************************************** #If ourBooksLowest price is 0 and $new_price is 0 then we couldn't find a bo ok at our level nor above. So we need to look below #***************************************************** if ( $ourBookLowestPrice == 0 && $new_price == 0 ) { #Level 4 New if ( $ourBookConditionLevel == 4 ) { if (defined($o_like_new[$rateIndex])) { and is
and is
and is
and is
if ( $o_like_new[$rateIndex]->{price} < 2 ) { #if the price is less than 2 bucks then the multiplier i s less $new_price = $o_like_new[$rateIndex]->{price} * 2; } else { $new_price = $o_like_new[$rateIndex]->{price} * 3; } $v->{comments} .= sprintf(qq[Lower level book found from 4 to 3 like_new price found is %1.2f<br>],$o_like_new[$rateIndex]->{price}) ; } elsif (defined($o_like_new[$rateIndex - 1])) { if( $o_like_new[$rateIndex - 1]->{price} < 2 ) { #if the price is less than 2 bucks then the multiplier is less $new_price = $o_like_new[$rateIndex - 1]->{price} * 2; } else{ $new_price = $o_like_new[$rateIndex - 1]->{price} * 3; } $v->{comments} .= sprintf(qq[Lower level book found from 4 to 3 like_new price found is %1.2f<br>],$o_like_new[$rateIndex - 1]->{price}) ; } } #Level 3 Like New elsif( $ourBookConditionLevel == 3 ) { if(defined($o_very_good[$rateIndex])) { #if( $o_very_good[$rateIndex]->{price} < 2 ) { #if the price is less than 2 bucks then the multiplier is less # $new_price = $o_very_good[$rateIndex]->{price} * 2; #} #else{ # $new_price = $o_very_good[$rateIndex]->{price} * 3; #} $new_price = $o_very_good[$rateIndex]->{price} * 2; $v->{comments} .= sprintf(qq[Lower level book found from 3 to 2 like_new price found is %1.2f -- New price = %1.2f<br>],$o_very_good[$rateIndex] ->{price}, $new_price); } elsif (defined($o_very_good[$rateIndex - 1])) { #if( $o_very_good[$rateIndex - 1]->{price} < 2 ){ #if the price is less than 2 bucks then the multiplier is less # $new_price = $o_very_good[$rateIndex - 1]->{price} * 2; #} #else{ # $new_price = $o_very_good[$rateIndex - 1]->{price} * 3; #} $new_price = $o_very_good[$rateIndex - 1]->{price} * 2; $v->{comments} .= sprintf(qq[Lower level book found from 3 to 2 like_new price found is %1.2f -- New price = %1.2f<br>],$o_very_good[$rateIndex - 1]->{price}, $new_price); } } #Level 2 Very Good elsif ( $ourBookConditionLevel == 2 ) { if (defined($o_good[$rateIndex])) { #if( $o_good[$rateIndex]->{price} < 2 ){ #if the price is less t han 2 bucks then the multiplier is less # $new_price = $o_good[$rateIndex]->{price} * 2; #} #else{ # $new_price = $o_good[$rateIndex]->{price} * 3;
#} $new_price = $o_good[$rateIndex]->{price} * 2; $v->{comments} .= qq[Lower level book found from 2 to 1<br>]; } elsif (defined($o_good[$rateIndex - 1])) { #if( $o_good[$rateIndex - 1]->{price} < 2 ){ #if the price is le ss than 2 bucks then the multiplier is less # $new_price = $o_good[$rateIndex - 1]->{price} * 2; #} #else{ # $new_price = $o_good[$rateIndex - 1]->{price} * 3; #} $new_price = $o_good[$rateIndex - 1]->{price} * 2; $v->{comments} .= qq[Lower level book found from 2 to 1<br>]; } } #Level 1 Good elsif( $ourBookConditionLevel == 1 ) { if(defined($o_acceptable[$rateIndex])) { $new_price = $o_acceptable[$rateIndex]->{price} * 2; $v->{comments} .= qq[Lower level book found from 1 to 0<br>]; } elsif(defined($o_acceptable[$rateIndex - 1])) { $new_price = $o_acceptable[$rateIndex - 1]->{price} * 2; $v->{comments} .= qq[Lower level book found from 1 to 0<br>]; } } #TODO How do we price a book we have nothing to compare too? (see requir ements) } #***************************************************** #Now check ourbookslowest price from it's same condition. #If it is lower than the one's we found above then use that one. #***************************************************** if ( $new_price == 0 && $ourBookLowestPrice > 0 ) { if( $ourBookLowestPrice < $new_price or $ourBookLowestPrice > 0 ) { $new_price = $ourBookLowestPrice; $v->{comments} .= qq[We calculated a new price from our waterfall tr ee and our book's condition is still the lowest<br>]; } } } # __________What should we do with the price now that we have it. # if ( $new_price == 0 ) { $v->{comments} .= qq[Unable to determine a new price<br>]; return $v; } else { $v->{comments} .= sprintf ( qq[Calculated New price is <b>%1.2f</b> --changed from <b>%1.2f</b><br>], $new_price, $my_price ); $v->{price}->{core} = $new_price; $v->{changed} = 'y'; }
# ###########################The logic ends here which are from the previous scrip t ######### # setting the min price as per the need if ($isBookOversized == 0) { if ( ($v->{price}->{core} < $min_new_price) && ($my_cond = 11) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $m in_new_price ); $v->{price}->{core} = $min_new_price; } elsif ( ($v->{price}->{core} < $min_ln_price) && ($my_cond = 4) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $m in_ln_price ); $v->{price}->{core} = $min_ln_price; } elsif ( ($v->{price}->{core} < $min_vg_price) && ($my_cond = 3) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $m in_ln_price ); $v->{price}->{core} = $min_vg_price; } elsif ( ($v->{price}->{core} < $min_g_price ) && ($my_cond = 2) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $$ min_g_price ); $v->{price}->{core} = $min_g_price; } elsif ( ($v->{price}->{core} < $min_a_price ) && ($my_cond = 1) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $$ min_g_price ); $v->{price}->{core} = $min_a_price; } } elsif ($isBookOversized == 1) { if ( ($v->{price}->{core} < $$min_new_oz_price) && ($my_cond = 11) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $$ min_new_oz_price ); $v->{price}->{core} = $$min_new_oz_price; } elsif ( ($v->{price}->{core} < $$min_ln_oz_price) && ($my_cond = 4) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $$ min_ln_oz_price); $v->{price}->{core} = $min_ln_price; } elsif ( ($v->{price}->{core} < $min_vg_oz_price) && ($my_cond = 3) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $m in_vg_oz_price ); $v->{price}->{core} = $min_vg_price; } elsif ( ($v->{price}->{core} < $min_g_oz_price ) && ($my_cond = 2) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $m in_g_oz_price ); $v->{price}->{core} = $min_g_price; } elsif ( ($v->{price}->{core} < $min_a_oz_price ) && ($my_cond = 1) ) { $v->{comments} .= sprintf ( qq[Setting to min of %1.2f.<br>], $$ min_a_oz_price ); $v->{price}->{core} = $min_a_price; } } if (($ageOfOurListing >= 1095) && ( $salesRank >= $min_Price_RankValue ) ) { # If the sales Rank > 5,000,000 && 3 yrs old book conditions $new_price = $min_price_3yr_over_above5000000; $v->{price}->{core} = $new_price; $v->{comments} .= sprintf ( qq[Changing to Price %1.2f because w e have Sales Rank > 5000000<br> ], $new_price); $v->{changed} = 'y';
return $v; } elsif (($ageOfOurListing >= 1095) && ( $salesRank < $min_Price_RankVal ue )) { # If the sales Rank < 5,000,000 && 3 yrs old book conditions $new_price = $min_price_3yr_over_low5000000; $v->{price}->{core} = $new_price; $v->{comments} .= sprintf ( qq[Changing to Price %1.2f because w e have 3 yrs old book > 5000000<br> ], $new_price); $v->{changed} = 'y'; return $v; } elsif (( $salesRank >= $min_Price_RankValue ) && (($my_cond = 4) || ($ my_cond = 3))) { # If the sales Rank >= 5,000,000 && book condition is good or acceptable $new_price = $min_price__a_g_above5000000; $v->{price}->{core} = $new_price; $v->{comments} .= sprintf ( qq[Changing to Price %1.2f because w e have Sales Rank > 5000000<br> ], $new_price); $v->{changed} = 'y'; return $v; } elsif (( $salesRank >= $min_Price_RankValue ) && (($my_cond = 2) || ($ my_cond = 1))) { # If the sales Rank >= 5,000,000 && book condition is new like New or ve ry good condition $new_price = $min_price__ln_vg_above5000000; $v->{price}->{core} = $new_price; $v->{comments} .= sprintf ( qq[Changing to Price %1.2f because w e have Sales Rank > 5000000<br> ], $new_price); $v->{changed} = 'y'; return $v; } if ( $v->{changed} eq 'y' ) { if ( $new_price < $min_new_price ) { $v->{price}->{core} = $min_new_price; #$new_price = $min_price; $v->{comments} .= sprintf ( qq[Changing to %1.2f because we have um<br> ], $min_new_price); $v->{changed} = 'y'; $v->{no_manual_reprice} = 1; } if( $isBookOverSized == 1 && $new_price < $min_new_oz_price ){ $v->{price}->{core} = $min_oversized; #$new_price = $min_oversized; $v->{comments} .= sprintf ( qq[Changing to %1.2f because this is ed<br>],$min_new_oz_price); $v->{changed} = 'y'; $v->{no_manual_reprice} = 1; } if( $isOurBookHard == 1 && $new_price < $min_hardBack ){ $v->{price}->{core} = $min_hardBack; #$new_price = $min_hardBack; $v->{comments} .= sprintf ( qq[Changing to %1.2f because this is ound book<br>],$min_hardBack); $v->{changed} = 'y'; $v->{no_manual_reprice} = 1; } if( $isOurBookNew == 1 && $new_price < $min_new_price ){ $v->{price}->{core} = $min_new_price; #$new_price = $min_new_price; $v->{comments} .= sprintf ( qq[Changing to %1.2f because this is
a minim
oversiz
a hardB
a new b
ook<br>],$min_new_price); $v->{changed} = 'y'; $v->{no_manual_reprice} = 1; } if( $Over180Days == 1 && $turn_on_masspaper == 1 && $my_price != $new_price ) { $v->{price}->{core} = $new_price; $v->{comments} .= sprintf ( qq[Changing to %1.2f because we are in the m ood to price mass paperbacks<br> ], $new_price); $v->{changed} = 'y'; $v->{no_manual_reprice} = 1; return $v; } #1.37 make sure that the price doesn't go up too much due to some moron putt ing in some price. if( $new_price > ($my_price * 2 ) ) { $v->{comments} .= sprintf ( qq[The new price is more than 2x of current, not going to reprice to %1.2f<br>],$new_price); $v->{changed} = 'n'; return $v; } #Check about of price drop from ourCurrentPrice to new price...it it exceeds our maximum forget about repricing. if( $new_price < ($my_price * $maximumDrop) ){ $v->{price}->{core} = $my_price; $v->{changed} = 'y'; $v->{comments} .= sprintf ( qq[The new price exceeded more than our maxi mum allowed drop...leaving at %1.2f<br>],$my_price);; $v->{no_manual_reprice} = 0; return $v; } if( $my_price == $new_price ) { #it is the same price no sense modifying it because will take longer to run $v->{changed} = 'n'; $v->{comments} .= qq[Not going to change this record because the new pri ce is same as current price<br>]; } } return $v; ######################################This is from the old script ############## ################### #****************************************Subroutines Done by MVS**************** ******** sub excludeIfIgnoreStringFound($inventory_source, @source_ignore_string, $v) { foreach $i (@source_ignore_string) { if( index($inventory_source, $i) >= 0 ) { $v->{comments} .= "This Book is being ignored because so urce is $i<br>"; if( $v->{no_manual_reprice} != 1 ) { $v->{no_manual_reprice} = 1; $v->{changed} = 'y'; break; } } } return $v; }
sub offerPriceFound(@offer_array, $o->{price},$found) { $found = 0; foreach my $offer (@offer_arrray) { if($offer->{price} == $o->{price} ) { $found = 1; last; } } return $found; } #******************************************************************************* **********