Skip to content

updating purcahse log check if value exists #2357

@mihaijoldis

Description

@mihaijoldis

An example:

$order = new WPSC_Purchase_Log( $log_id );
$order->set( 'my_custom_data', '1' )->save();

throws a notice since my_custom_data is not a field in the purchase log table but the value does get saved as a meta field.
save() would normally do that on it’s own, but it supposes that you’re updating something on the purchase table as well.
Seems to me that somewhere in here, we should be validating the $data. If it’s empty, we’ve got nothing to update, and should bail.

$data = apply_filters( 'wpsc_purchase_log_update_data', $this->data );
$format = $this->get_data_format( $data );
$result = $wpdb->update( WPSC_TABLE_PURCHASE_LOGS, $data, array( $where_col => $where_val ), $format, array( $where_format ) );
do_action( 'wpsc_purchase_log_update', $this );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions