21288 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1564 Views |
-
How to create php class for only

3 June 2010 at 7:41pm
Hi,
What are steps to create a class for only update database ?
That is: I've a product class with some options. Then, after some action, a remote webservice return data on my site ( like PayPal IPN ) and I've update products info.
And How will be link for call that action? -
Re: How to create php class for only

3 June 2010 at 10:05pm Last edited: 3 June 2010 10:05pm
Well if you want a blank php class then in SS you can do exactly as you do in standard php, simply don't extend page
<?php
class MyClass {
function foo() {
// update db you can use DB::query(), DataObject::get()...
}
}?>
And if thats in your mysite folder you can simply to this in any other function / class in your project you can do
$var = new MyClass();
$var->foo();Nothing fancy their, just standard PHP OOP. If you provide more specific information about what you want to do we may be able to help further.
-
Re: How to create php class for only

4 June 2010 at 3:31am
Yes, I know.
But I wish to update fields of "product" that "product" is a SS class that extend page or
Do I made "Product" class as dataobject? -
Re: How to create php class for only

4 June 2010 at 9:17am
Do I made "Product" class as dataobject?
Just to be clear, your "product" is not referring the the product class that is bundled with ecommerce? if it is you should have this in the ecommerce forum.
If your building your own Product class the option of extending Page or Dataobject depends on what you want. Do you want each product to have a page on the site? Do you want to manage products in the sitetree? If these are yes then extend Page, otherwise extend DataObject.
-
Re: How to create php class for only

4 June 2010 at 9:04pm
I don't use ecommerce module. I need a simple simple cart. I simulate cart with simplejs javascript.
I need product to manage a Wedding-wishlist.
I simulated a list as a Product Categorie and each product with a page child of Categories.
After a person books a gift and payed via PayPal, I need to setup booked flag at true value. So, that product is not more in list.
So, I need a method to read returned value from PayPal.
| 1564 Views | ||
|
Page:
1
|
Go to Top |

