Copy link to clipboard
Copied
Can anyone help please.
I am trying to edit AS3 flash mp3 album cart I bought from a company that has had many issues and the seller refuses to offer
any assistance or even answer.
Well, I am solving a few display issues and minor scripting stuff as well but I am at a loss of solving this particular issue.
So, I upload album songs (individually) so they can purchased as a single ("Buy Track" Button) or they can buy the
album that features all the tracks ("Buy Album" Button).
In the MySQL database the songs are uploaded like this, each with its own ID etc and the Album that the songs belong to
are associated with "option 2" as the Album Name, that is displayed in the track manager of the player.
Now the problem I am having is that if for instance the buyer reviews songs in the player and decides he likes an Album
called
"The Moment of Time"
and presses the "Buy Album" button it will add all the songs featured in that album which is fine, but if somewhere in
the player there was another album called
"Time Waits"
it will also add the songs belonging to this album because the "Buy Album" button includes all albums if they have a same
word in the description (in this case "Time")
How can I get the "Buy Album" to add the the tracks to the cart that only belong to that album with an exact match and not add others that
have the same word into it.
As you can see below if I wanted to buy "A Album" and pressed the buyalbumbutton it adds all 3 songs from the 2 albums because of a word match
which it fetches from the option 2 in the database table.
Can this be done inside the MySQL database table structure or do I need to edit any of the AS3 files that I have included
below that seems to show this function.
I hope this makes sense to someone. I am a beginner with AS3 and PHP coding, so have been unable to see where the
problem lies.
Thank you
FILE 1
/**
* IFlashCartInterpretor
*
*
*
*
*/
package lod.skin
{
import flash.events.IEventDispatcher;
public interface IFlashCartInterpretor extends IEventDispatcher
{
/**
* Send a string and array of fields to query for a list of products that match value in some manner.
*
* Similar to a search engine.
*
* Available fields are:
* "category" - search the category field
* "name" - serach the name of a product
* "itemcode" - search the itemcode of a product
* "price" - search the price field
* "shipping" - search the shipping cost field
* "description" - search the description field
* "option1" - search the option1 field
* "option2" - search the option2 field
*
* *special*
* "all" - search all fields at once
*
* null - if you pass null as the fields param you will query only categories, this is faster then querying "category"
* null, "all" - if you pass null as the fields and "all" as the param you will retrieve ALL the known products. This is useful for mini carts.
*/
function queryProducts( fields:Array, value:String ):void
/**
* method used to purchase or remove the purchase of a product.
*
* The params are the same params received back from the cart update
*
* except for register, register is the same value returned from a IProductInterpretor.register value
*/
function purchaseProduct( register:int, quantity:int, option1:String, option2:String, replace:Boolean=false ):void
function removePurchase( register:int, quantity:int, option1:String, option2:String ):void
/**
* perform a checkout
*
* types supported:
* "paypal" - check out using Paypal
* "tocheckout" - check out using 2Checkout
* "authorizenet" - check out using Authorize.net
*/
function checkOut( type:String ):void
//product list info
//array of the names of categories
function get categories():Array
//array of IProductInterpretor objects of the products currently selected, this changes just before onProductPoolUpdate after querying
function get currentProductSelections():Array
//checkout info
function get checkoutTypes():Array
function get currency():String
//cart information
function get numberOfCartMembers():int
function get totalPrice():Number //this is just the prices added up
function get totalShipping():Number //this is the shipping costs added up
function get totalCost():Number //this is the prices and shipping combined
/**
* This is a special array of Objects that describe the current products in the shopping cart
*
* each object consists of 4 properties:
* product - this is an IProductInterpretor object for the product
* quantity - the number of this product being purchased
* option1 - what the option1 choice is
* option2 - what the option2 choice is
*
*/
function get cartMembers():Array
}
}
FILE 2
/**
* Buy Methods
*/
protected function buyCurrButtonHit(e:MouseEvent):void
{
var prod:IProductInterpretor = _skin.trackManager.getCurrentProductPlaying();
if (!prod) return;
if (e.currentTarget == _skin.view._buycurr_btn) buyTrack( prod );
else if (e.currentTarget == _skin.view._buycurrAlbum_btn) buyAlbumFrom( prod );
}
protected function datalistHit(e:ListEvent):void
{
var item:Object = e.item;
var index:int = e.index;
var col:int = e.columnIndex;
var renderer:ICellRenderer = _skin.view._datalist_grid.getCellRendererAt( index, col );
var isBuyCell:Boolean = renderer is BuyButtonCell;
var isBuyAlbumCell:Boolean = renderer is BuyAlbumButtonCell;
if ( !isBuyCell && !isBuyAlbumCell )
{
return;
}
var prod:IProductInterpretor = item.product;
if (isBuyCell)
{
buyTrack( prod );
} else if ( isBuyAlbumCell )
{
buyAlbumFrom( prod );
}
}
protected function buyTrack( prod:IProductInterpretor ):void
{
_skin.cart.purchaseProduct( prod.register, 1, null, null, true );
}
protected function buyAlbumFrom( prod:IProductInterpretor ):void
{
var album:String = prod[BlackMusicSkin.ALBUM_QUERYNAME];
_skin.view._search_txt.text = album;
this.attemptAlbumPurchase = true;
_skin.cart.queryProducts( [ BlackMusicSkin.ALBUM_QUERYNAME ], album );
}
public function albumPurchaseReturn():void
{
_buyAlbumSkin.updateMembers();
showAlert( _buyAlbumSkin );
}
FILE 3
/**
* IProductInterpretor
*
*
*
*
*/
package lod.skin
{
import flash.display.DisplayObject;
public interface IProductInterpretor
{
/**
* This is a null property reserved for you to use as a reference to any data including visual data
*
* the Cart System does not ever use this property. It is merely there so you can store some
* reused reference
*/
function get view():*
function set view( value:* ):void
/**
* this is your actual product information
*
* all the fields may not have properties depending on the kind of cart this will be.
*
* data - the XML object this data was retrieved from. This is a clone of the XML object.
* category - the category this product is a member of
* register - this is a reserved value describing the position in the ProductPool. This property is used to inform the purchase and removePurchase methods which product is being purchased.
* id - this is the 'id' property from the database. It's hardly needed for much.
* name - the name of the product
* thumb - this is the url to a thumbnail image of the object. It is optionally set
* fullimage - this is the url to a fullsize image of the object. It is optionally set
* itemcode - this is the "item number" in the cart registry. It is to let the merchant sort their products on the database.
* price - the unit price of the product
* shipping - the unit shipping of the product
* description - a string (may or may not be html) describing the product. Can be very long.
*
* *very special props*
*
* option1 - this is ARTIST NAME
*
* option2 - this is for ALBUM NAME
*
*
* isAutodownload - this product has some digital media that can be downloaded if true
*/
function get data():XML
function get category():String
function get register():int
function get id():int
function get name():String
function get thumb():String
function get fullimage():String
function get itemcode():int
function get price():Number
function get shipping():Number
function get description():String
function get option1():String
function get option2():String
function get demolink():String
function get isAutodownload():Boolean
function toString(html:Boolean=true):String
}
}
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now