• taradyn
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I've created a cookie as shown: 
cookieJar c = new cookieJar(p.productid, selSize, selColour, String.valueOf(p.qtyToBuy));
and append any newly added data to the cookie:  
cookieJar c = new cookieJar(p.productid + ',' + pid, selSize + ',' + psize, selColour + ',' + pcol ,String.valueOf(p.qtyToBuy) + ',' + pqty);

I would like to delete the cookie data based on their productid. But not sure on how to do so. I've read the cookie class docs and found this:

maxAge
Type: Integer
A number representing how long a cookie is valid for in seconds. If set to less than zero, a session cookie is issued. If set to zero, the cookie is deleted.


How do I delete the data?

0down votefavorite

I've a parent object (Product) and a child (Inventory). I'm trying to retrieve the value of the child object from a DisplayProducts class that I've created.
 
public class DisplayProducts {
    private Product__c products;

public DisplayProducts(Product__c item) {
    this.products = item;

}

// Properties for use in the Visualforce view
public String name {
    get { return products.Name; }
}

public String colour {
//error here 
        get { return  products.Inventorys__r.Colour__c; }

    }

public class Product {

public List<DisplayProducts> getProducts() {

        if(products == null) {
            products = new List<DisplayProducts>();

            for(Product__c item : [Select ProductID__c,Name, Price__c, (SELECT Inventory__c.Size__c, Inventory__c.Colour__c,  Inventory__c.Quantity__c FROM Product__c.Inventorys__r) 
                From Product__c WHERE ProductID__c = :prodID]) {

                products.add(new DisplayProducts(item));
            }
    }    
    return products;
}

}



I keep getting a compile error: invalid FK relationship.

I tried but it will only retrieved the first element.
products.Inventorys__r[0].Colour__c;

How do I retrieve the child item via the DisplayProducts Class? Any help will be greatly appreciated.

Thank you.

0down votefavorite

I've a parent object (Product) and a child (Inventory). I'm trying to retrieve the value of the child object from a DisplayProducts class that I've created.
 
public class DisplayProducts {
    private Product__c products;

public DisplayProducts(Product__c item) {
    this.products = item;

}

// Properties for use in the Visualforce view
public String name {
    get { return products.Name; }
}

public String colour {
//error here 
        get { return  products.Inventorys__r.Colour__c; }

    }

public class Product {

public List<DisplayProducts> getProducts() {

        if(products == null) {
            products = new List<DisplayProducts>();

            for(Product__c item : [Select ProductID__c,Name, Price__c, (SELECT Inventory__c.Size__c, Inventory__c.Colour__c,  Inventory__c.Quantity__c FROM Product__c.Inventorys__r) 
                From Product__c WHERE ProductID__c = :prodID]) {

                products.add(new DisplayProducts(item));
            }
    }    
    return products;
}

}



I keep getting a compile error: invalid FK relationship.

I tried but it will only retrieved the first element.
products.Inventorys__r[0].Colour__c;

How do I retrieve the child item via the DisplayProducts Class? Any help will be greatly appreciated.

Thank you.